diff options
author | Mikael Kanstrup <mikael.kanstrup@gmail.com> | 2015-11-23 16:33:42 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-11-25 14:18:47 +0000 |
commit | 9a2d16bac72ff9810865566abe260f19ea3d8202 (patch) | |
tree | 5d6c29b7bca89f885ea1b5b3fe83a94a2ed927c5 | |
parent | dcfea6a06ddf7adeafc8613efe74310251201789 (diff) |
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@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r-- | epan/prefs.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index a1b4072b0e..4dd4e54244 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -4944,6 +4944,7 @@ write_prefs(char **pf_path_return) *pf_path_return = pf_path; return errno; } + g_free(pf_path); } else { pf = stdout; } |