aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/capture_dlg.c
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@gmail.com>2015-11-23 16:33:41 +0100
committerPeter Wu <peter@lekensteyn.nl>2015-11-25 12:03:33 +0000
commit9107fb6039260ad2e84f303fd824dc66e62bdd24 (patch)
tree154d740bde2484a932109d5eb7fdb7a74f80e55a /ui/gtk/capture_dlg.c
parent571ed4d25907dae80bd9c0e3e5822fe473d77d2d (diff)
Fix memory leaks related to hide_interface function
Valgrind report leaks like these: 6 bytes in 6 blocks are definitely lost in loss record 2,197 of 46,703 at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0xA5C1610: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0xA5D8B0E: g_strdup (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0x69A211: ManageInterfacesDialog::localAccepted() (manage_interfaces_dialog.cpp:454) by 0x69A500: ManageInterfacesDialog::on_buttonBox_accepted() (manage_interfaces_dialog.cpp:211) by 0x71DB32: ManageInterfacesDialog::qt_metacall(QMetaObject::Call, int, void**) (manage_interfaces_dialog.moc.cpp:245) by 0xBEBE36C: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1) by 0xBEBE2A5: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1) by 0xAF87E41: QAbstractButton::clicked(bool) (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.2.1) by 0xAD11095: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.2.1) by 0xAD11BAD: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.2.1) by 0xAD11D23: QAbstractButton::mouseReleaseEvent(QMouseEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.2.1) 96 bytes in 4 blocks are definitely lost in loss record 42,458 of 52,779 at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0xA5C1610: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0xA5D722D: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0xA5B84F3: g_list_append (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0x731F9A: hide_interface (iface_lists.c:426) by 0x69A211: ManageInterfacesDialog::localAccepted() (manage_interfaces_dialog.cpp:454) by 0x69A4F0: ManageInterfacesDialog::on_buttonBox_accepted() (manage_interfaces_dialog.cpp:211) by 0x71DB22: ManageInterfacesDialog::qt_metacall(QMetaObject::Call, int, void**) (manage_interfaces_dialog.moc.cpp:245) by 0xBEBE36C: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1) by 0xBEBE2A5: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1) by 0xAF87E41: QAbstractButton::clicked(bool) (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.2.1) by 0xAD11095: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.2.1) These are caused by leaks inside hide_interface function and among its users. Fixed by letting hide_interface function free its resources properly and making sure the users follow the pattern. Change-Id: I91527b83d36dc38b402d0f4a1db4b7db40fd83f9 Reviewed-on: https://code.wireshark.org/review/12113 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'ui/gtk/capture_dlg.c')
-rw-r--r--ui/gtk/capture_dlg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index e9a4f22edd..a3f3390ce0 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -3956,7 +3956,7 @@ ok_remote_cb(GtkWidget *win _U_, gpointer *data _U_)
} while (gtk_tree_model_iter_next(model, &iter));
g_free(name);
}
- hide_interface(g_strdup(new_hide));
+ hide_interface(new_hide);
/* Refresh all places that are displaying an interface list
that includes interfaces other than local interfaces