aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@gmail.com>2015-11-23 16:33:40 +0100
committerMichael Mann <mmann78@netscape.net>2015-11-25 13:13:58 +0000
commit479ab3bcdc8d79b27bfc99fcde073457f72126ac (patch)
tree8b0e92cfca9e8a03f9922964cb5e443502f1d6c2
parentcec0593ae6c3bca65eff65741c2a10f3de3e0afe (diff)
Fix memory leak in capture_get_if_capabilities
Valgrind reports memory leaks like these: 154 bytes in 10 blocks are possibly lost in loss record 8,660 of 11,855 at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0xBD9EA38: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4) by 0xBDB3358: g_strndup (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4) by 0xBDB49AD: g_strsplit (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4) by 0x502291: capture_get_if_capabilities (capture_ifinfo.c:269) by 0x50A4CC: scan_local_interfaces (iface_lists.c:186) by 0x4C4BBD: refresh_local_interface_lists (capture_dlg.c:6117) by 0x504EC8: iface_mon_handler2 (iface_monitor.c:113) by 0xC9ADF1D: ??? (in /lib/libnl-3.so.200.3.0) by 0xC56DF19: ??? (in /usr/lib/libnl-route-3.so.200.3.0) by 0xC9ABE5E: nl_cache_parse (in /lib/libnl-3.so.200.3.0) by 0xC9AF5CA: nl_msg_parse (in /lib/libnl-3.so.200.3.0) Under certain conditions raw_list variable was not freed properly. Change-Id: Ibbaf0d67d983ee6912cfc9dc1a3169bc773b03c9 Reviewed-on: https://code.wireshark.org/review/12112 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--capchild/capture_ifinfo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c
index 3a25f2fa22..b6bef3cf1e 100644
--- a/capchild/capture_ifinfo.c
+++ b/capchild/capture_ifinfo.c
@@ -278,6 +278,7 @@ capture_get_if_capabilities(const gchar *ifname, gboolean monitor_mode,
if (err_str) {
*err_str = g_strdup("Dumpcap returned no interface capability information");
}
+ g_strfreev(raw_list);
return NULL;
}
@@ -302,6 +303,7 @@ capture_get_if_capabilities(const gchar *ifname, gboolean monitor_mode,
raw_list[0]);
}
g_free(caps);
+ g_strfreev(raw_list);
return NULL;
}