From e26926432d163cd835b7f8f1ab51e084c04050b7 Mon Sep 17 00:00:00 2001 From: Mikael Kanstrup Date: Fri, 25 Aug 2017 10:14:15 +0200 Subject: 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 --- capture_opts.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'capture_opts.c') 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; } -- cgit v1.2.3