Ticket #3567: 0001-configure_panel_listing-fix-memory-leak.patch

File 0001-configure_panel_listing-fix-memory-leak.patch, 2.1 KB (added by andrew_b, 8 years ago)
  • src/filemanager/cmd.c

    From 76ad0a532b737b83727dfb08fa610ba7ced6c5bc Mon Sep 17 00:00:00 2001
    From: Andrew Borodin <aborodin@vmail.ru>
    Date: Thu, 26 Nov 2015 21:49:26 +0300
    Subject: [PATCH] (configure_panel_listing): fix memory leaks.
    
    Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
    ---
     src/filemanager/cmd.c | 19 +++++++++----------
     1 file changed, 9 insertions(+), 10 deletions(-)
    
    diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c
    index 52c8c5e..0179aed 100644
    a b nice_cd (const char *text, const char *xtext, const char *help, 
    466466/* --------------------------------------------------------------------------------------------- */ 
    467467 
    468468static void 
    469 configure_panel_listing (WPanel * p, int list_type, int brief_cols, int use_msformat, char *user, 
    470                          char *status) 
     469configure_panel_listing (WPanel * p, int list_type, int brief_cols, int use_msformat, char **user, 
     470                         char **status) 
    471471{ 
    472472    p->user_mini_status = use_msformat; 
    473473    p->list_type = list_type; 
    configure_panel_listing (WPanel * p, int list_type, int brief_cols, int use_msfo 
    477477    else if (list_type == list_user || use_msformat) 
    478478    { 
    479479        g_free (p->user_format); 
    480         p->user_format = user; 
     480        p->user_format = *user; 
     481        *user = NULL; 
    481482 
    482483        g_free (p->user_status_format[list_type]); 
    483         p->user_status_format[list_type] = status; 
     484        p->user_status_format[list_type] = *status; 
     485        *status = NULL; 
    484486 
    485487        set_panel_formats (p); 
    486488    } 
    487     else 
    488     { 
    489         g_free (user); 
    490         g_free (status); 
    491     } 
    492489 
    493490    set_panel_formats (p); 
    494491    do_refresh (); 
    change_listing_cmd (void) 
    16581655    { 
    16591656        switch_to_listing (MENU_PANEL_IDX); 
    16601657        p = MENU_PANEL_IDX == 0 ? left_panel : right_panel; 
    1661         configure_panel_listing (p, list_type, brief_cols, use_msformat, user, status); 
     1658        configure_panel_listing (p, list_type, brief_cols, use_msformat, &user, &status); 
     1659        g_free (user); 
     1660        g_free (status); 
    16621661    } 
    16631662} 
    16641663