From a53ab9dfcc87ec817467a2a9c2259b0a70a1dd78 Mon Sep 17 00:00:00 2001 From: Mikael Kanstrup Date: Sun, 31 Jan 2016 20:55:55 +0100 Subject: Fix leaks when spawning extcap processes Valgrind reports leaks like these when spawning extcap processes (for example when displaying or refreshing interface list with extcap interfaces present): 3,917 (464 direct, 3,453 indirect) bytes in 29 blocks are definitely lost in loss record 58,301 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 0xA6B913B: g_error_new_valist (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0xA6B94ED: g_set_error (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0xA710B03: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0xA710E17: g_spawn_sync (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) by 0x44C677: extcap_foreach (extcap.c:199) by 0x44CCAD: extcap_interface_list (extcap.c:413) by 0x72B548: capture_interface_list (capture_ifinfo.c:126) by 0x7336FA: scan_local_interfaces (iface_lists.c:141) by 0x55F01F: WiresharkApplication::refreshLocalInterfaces() (wireshark_application.cpp:898) ... Change-Id: If8f750f5f8fa42a6f0884bb0e6bbbd71bd8f68aa Reviewed-on: https://code.wireshark.org/review/13631 Petri-Dish: Roland Knall Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall --- extcap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extcap.c b/extcap.c index a4e656f5bf..938042880a 100644 --- a/extcap.c +++ b/extcap.c @@ -177,7 +177,6 @@ static void extcap_foreach(gint argc, gchar **args, extcap_cb_t cb, gchar *command_output = NULL; gboolean status = FALSE; gint exit_status = 0; - GError *error = NULL; gchar **envp = NULL; /* full path to extcap binary */ @@ -201,7 +200,7 @@ static void extcap_foreach(gint argc, gchar **args, extcap_cb_t cb, status = g_spawn_sync(dirname, argv, envp, (GSpawnFlags) 0, NULL, NULL, - &command_output, NULL, &exit_status, &error); + &command_output, NULL, &exit_status, NULL); if (status && exit_status == 0) keep_going = cb(extcap_path->str, ifname, command_output, cb_data, err_str); -- cgit v1.2.3