aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@gmail.com>2017-08-25 10:14:15 +0200
committerAnders Broman <a.broman58@gmail.com>2017-08-28 14:42:28 +0000
commite26926432d163cd835b7f8f1ab51e084c04050b7 (patch)
treed877a179835199a660ffd4fb65c1077f6a5408f3
parent8873c7e494018637449a17a7f7ddaf88ad43f3c6 (diff)
Free interface elements on cleanup
At shutdown the array keeping all network interfaces is freed. The array elements however are not making valgrind and ASAN complain. Make sure the elements are freed on cleanup. Ping-Bug: 13864 Change-Id: I1efeb03f42fb6f0b87dada8ef50d85f47f93e0dc Reviewed-on: https://code.wireshark.org/review/23202 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--capture_opts.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/capture_opts.c b/capture_opts.c
index 51ce4b7bd4..33cb9d4fbb 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -142,6 +142,11 @@ capture_opts_cleanup(capture_options *capture_opts)
capture_opts->ifaces = NULL;
}
if (capture_opts->all_ifaces) {
+ while (capture_opts->all_ifaces->len > 0) {
+ interface_t *device = &g_array_index(capture_opts->all_ifaces, interface_t, 0);
+ capture_opts_free_interface_t(device);
+ capture_opts->all_ifaces = g_array_remove_index(capture_opts->all_ifaces, 0);
+ }
g_array_free(capture_opts->all_ifaces, TRUE);
capture_opts->all_ifaces = NULL;
}