Changeset 2489


Ignore:
Timestamp:
Jun 25, 2008, 11:20:48 AM (12 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Removed a double-free, check if ptr==NULL before freeing in several places
File:
1 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/main.c

    r2488 r2489  
    7979int main(int argc, char **argv)
    8080{
    81     static cucul_canvas_t *cv;
    82     static caca_display_t *dp;
     81    static cucul_canvas_t *cv = NULL;
     82    static caca_display_t *dp = NULL;
    8383    struct screen_list *screen_list = NULL;
    8484    struct recurrent_list *recurrent_list = NULL;
     
    547547        else if(ret && (caca_get_event_type(&ev) & CACA_EVENT_QUIT))
    548548        {
     549            refresh = 1;
    549550            break;
    550551        }
     
    638639        close(screen_list->socket);
    639640
    640     free(screen_list->screen);
     641    if(screen_list->screen) free(screen_list->screen);
    641642
    642643
     
    648649        struct option *kromeugnon = option;
    649650        option = option->next;
    650         free(kromeugnon->key);
    651         free(kromeugnon->value);
    652         free(kromeugnon);
    653     }
    654 
    655     free(screen_list);
     651        if(kromeugnon->key)   free(kromeugnon->key);
     652        if(kromeugnon->value) free(kromeugnon->value);
     653        if(kromeugnon)        free(kromeugnon);
     654    }
     655
     656    if(screen_list)
     657        free(screen_list);
    656658
    657659    for(i=0; i<recurrent_list->count; i++)
     
    661663    }
    662664
    663     free(recurrent_list->recurrent);
    664     free(recurrent_list);
    665 
    666     free(user_path);
    667 
     665    if(recurrent_list->recurrent) free(recurrent_list->recurrent);
     666    if(recurrent_list)            free(recurrent_list);
    668667
    669668    return mainret;
Note: See TracChangeset for help on using the changeset viewer.