Wireshark-commits: [Wireshark-commits] master-2.0 20304a4: packet-nfs: fix double-free

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Wed, 24 Feb 2016 11:56:52 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=20304a4e3a2f38168f1f2f0fdc356dd1d8fc384a
Submitter: Peter Wu (peter@xxxxxxxxxxxxx)
Changed: branch: master-2.0
Repository: wireshark

Commits:

20304a4 by Tigran Mkrtchyan (tigran.mkrtchyan@xxxxxxx):

    packet-nfs: fix double-free
    
    fixes regression introduced by f5340b2
    
    g_hash_table_remove will call free on object, thus there is no need for explicit g_free,
    as is causes a double-free:
    
    *** Error in `/usr/sbin/wireshark-gtk': double free or corruption (fasttop): 0x0000555556e6bf50 ***
    ======= Backtrace: =========
    /lib64/libc.so.6(+0x77da5)[0x7fffef80ada5]
    /lib64/libc.so.6(+0x804fa)[0x7fffef8134fa]
    /lib64/libc.so.6(cfree+0x4c)[0x7fffef816cac]
    /lib64/libglib-2.0.so.0(g_free+0xe)[0x7ffff09665ee]
    /lib64/libglib-2.0.so.0(+0x388ba)[0x7ffff094f8ba]
    /lib64/libwireshark.so.6(+0x1cfb46b)[0x7ffff49d646b]
    /lib64/libwireshark.so.6(+0x1d03d99)[0x7ffff49ded99]
    /lib64/libwireshark.so.6(+0x173b11f)[0x7ffff441611f]
    /lib64/libwireshark.so.6(+0x173bba5)[0x7ffff4416ba5]
    /lib64/libwireshark.so.6(call_dissector_with_data+0x26)[0x7ffff4419ad6]
    
    .....
    
    The g_hash_table_insert will remove and deallocate existing entry, so we
    don't need to do it at all.
    
    Change-Id: Ide47d1f9deb3e1b0d8adefd31fc6f3bf5cbaa010
    Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@xxxxxxx>
    Reviewed-on: https://code.wireshark.org/review/14096
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    (cherry picked from commit f897899f6137cc471b3236719b96507471d58884)
    Reviewed-on: https://code.wireshark.org/review/14115
    

Actions performed:

    from  307bbd2   ber: avoid deep recursion for constructed strings
    adds  20304a4   packet-nfs: fix double-free


Summary of changes:
 epan/dissectors/packet-nfs.c |   21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)