Ticket #3567: mc-3567-fix-memleak-at-configure_panel_listing.patch

File mc-3567-fix-memleak-at-configure_panel_listing.patch, 2.8 KB (added by and, 5 years ago)

additional memleak fix

  • src/filemanager/cmd.c

    From 853deffd00cb70de6b664b7eb9c8b6239c5e92db Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Wed, 25 Nov 2015 16:42:11 +0000
    Subject: [PATCH] fix memleak at configure_panel_listing()
    
    trigger: enter listing mode -> active brief file list -> hit ok -> exit mc
    
    found by Clang/AddressSanitizer
    
    Direct leak of 58 byte(s) in 2 object(s) allocated from:
        #0 0x4c7c30 in malloc (/tmp/portage/app-misc/mc-9999/work/mc-9999/src/.libs/mc+0x4c7c30)
        #1 0x7fbd492dfd38 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x66d38)
        #2 0x7fbd49308011 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x8f011)
        #3 0x7fbd49fb9cea in quick_dialog_skip /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/quick.c:600:59
        #4 0x5e17c5 in panel_listing_box /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/boxes.c:831:13
        #5 0x5f39c0 in change_listing_cmd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/cmd.c:1656:17
        #6 0x52d79d in midnight_execute_cmd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/midnight.c:1113:9
        #7 0x7fbd49fb4e79 in menubar_execute /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/menu.c:341:9
        #8 0x7fbd49fb34c2 in menubar_handle_key /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/menu.c:539:13
        #9 0x7fbd49fb1520 in menubar_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/menu.c:597:13
        #10 0x7fbd49f9b0e3 in dlg_try_hotkey /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:450:19
        #11 0x7fbd49f9a490 in dlg_key_event /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:509:19
        #12 0x7fbd49f9a952 in frontend_dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:570:9
        #13 0x7fbd49f9a655 in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:1267:5
        #14 0x52bb1d in do_nc /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/midnight.c:1757:9
        #15 0x4f94b7 in main /tmp/portage/app-misc/mc-9999/work/mc-9999/src/main.c:463:21
        #16 0x7fbd483b5953 in __libc_start_main (/lib64/libc.so.6+0x20953)
        #17 0x427408 in _start (/tmp/portage/app-misc/mc-9999/work/mc-9999/src/.libs/mc+0x427408)
    
    SUMMARY: AddressSanitizer: 58 byte(s) leaked in 2 allocation(s).
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/cmd.c | 4 ++++
     1 file changed, 4 insertions(+)
    
    diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c
    index 52c8c5e..587190e 100644
    a b configure_panel_listing (WPanel * p, int list_type, int brief_cols, int use_msfo 
    473473    p->list_type = list_type; 
    474474 
    475475    if (list_type == list_brief) 
     476    { 
    476477        p->brief_cols = brief_cols; 
     478        g_free (user); 
     479        g_free (status); 
     480    } 
    477481    else if (list_type == list_user || use_msformat) 
    478482    { 
    479483        g_free (p->user_format);