If there are extcap interfaces present then each time the capture
interfaces list is displayed or refreshed a number of extcap related
allocations are leaked.
Valgrind reports leaks like these:
2,007 (144 direct, 1,863 indirect) bytes in 6 blocks are definitely lost in loss record 64,328 of 65,138
at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0xA6D2610: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
by 0xA6E822D: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
by 0xA6C94F3: g_list_append (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
by 0x44C9AF: search_cb (extcap.c:451)
by 0x44C6FC: extcap_foreach (extcap.c:204)
by 0x44CDFF: extcap_get_if_configuration (extcap.c:473)
by 0x44CE3C: extcap_has_configuration (extcap.c:489)
by 0x654356: InterfaceTree::display() (interface_tree.cpp:199)
by 0x6547DF: InterfaceTree::getInterfaceList() (interface_tree.cpp:252)
by 0xBFCF2A5: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
by 0x563F9A: WiresharkApplication::allSystemsGo() (wireshark_application.cpp:914)
by 0x4478D9: main (wireshark-qt.cpp:1373)
9,126 (432 direct, 8,694 indirect) bytes in 18 blocks are definitely lost in loss record 58,524 of 58,638
at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0xA6D2610: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
by 0xA6E822D: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
by 0xA6C94F3: g_list_append (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
by 0x44C9AF: search_cb (extcap.c:451)
by 0x44C6FC: extcap_foreach (extcap.c:204)
by 0x44CDFF: extcap_get_if_configuration (extcap.c:473)
by 0x44CE3C: extcap_has_configuration (extcap.c:489)
by 0x654356: InterfaceTree::display() (interface_tree.cpp:199)
by 0xBFCF2A5: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.2.1)
by 0x4A3214: MainWindow::on_actionCaptureRefreshInterfaces_triggered() (main_window_slots.cpp:3605)
...
Change-Id: I9433b8e36813cbef9dca5ab08074e985793f4d0d
Reviewed-on: https://code.wireshark.org/review/13617
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
return g_list_sort ( ret, if_info_compare );
}
+static void extcap_free_arg_elem(gpointer data, gpointer user_data _U_) {
+ extcap_free_arg((extcap_arg *) data);
+ g_free(data);
+}
+
static void extcap_free_if_configuration(GList *list)
{
GList *elem, *sl;
if (elem->data != NULL) {
/* g_list_free_full() only exists since 2.28. */
sl = g_list_first((GList *)elem->data);
- g_list_foreach(sl, (GFunc)g_free, NULL);
+ g_list_foreach(sl, (GFunc)extcap_free_arg_elem, NULL);
g_list_free(sl);
}
}
}
walker = walker->next;
}
+ extcap_free_if_configuration(arguments);
return found;
}