Wireshark-commits: [Wireshark-commits] master 9a2d16b: Fix memory leak in write_prefs

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Wed, 25 Nov 2015 14:18:56 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=9a2d16bac72ff9810865566abe260f19ea3d8202
Submitter: Peter Wu (peter@xxxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

9a2d16b by Mikael Kanstrup (mikael.kanstrup@xxxxxxxxx):

    Fix memory leak in write_prefs
    
    Valgrind reports leaks like these:
    384 bytes in 8 blocks are definitely lost in loss record 43,909 of 46,703
      at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      by 0xD6A055F: __vasprintf_chk (vasprintf_chk.c:80)
      by 0xA5FD0FB: g_vasprintf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
      by 0xA5D8C7F: g_strdup_vprintf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
      by 0xA5D8D1B: g_strdup_printf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
      by 0x6854FA6: write_prefs (prefs.c:4941)
      by 0x733A9A: prefs_main_write (preference_utils.c:266)
      by 0x5F8A5C: CaptureInterfacesDialog::saveOptionsToPreferences() (capture_interfaces_dialog.cpp:851)
      by 0x5F93CD: CaptureInterfacesDialog::on_manage_clicked() (capture_interfaces_dialog.cpp:858)
      by 0x7182AC: CaptureInterfacesDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (capture_interfaces_dialog.moc.cpp:316)
      by 0x718822: CaptureInterfacesDialog::qt_metacall(QMetaObject::Call, int, void**) (capture_interfaces_dialog.moc.cpp:413)
      by 0xBEBE36C: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
    
    When storing user preferences the constructed pathname of user's
    preferences file is not freed properly.
    
    Change-Id: I5cdc53ca836503af048e1d06e4614d83ef8921ac
    Reviewed-on: https://code.wireshark.org/review/12114
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    

Actions performed:

    from  dcfea6a   create_dissector_handle -> new_create_dissector_handle
    adds  9a2d16b   Fix memory leak in write_prefs


Summary of changes:
 epan/prefs.c |    1 +
 1 file changed, 1 insertion(+)