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>
This commit is contained in:
Mikael Kanstrup 2017-08-25 10:14:15 +02:00 committed by Anders Broman
parent 8873c7e494
commit e26926432d
1 changed files with 5 additions and 0 deletions

View File

@ -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;
}