diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-03-13 03:48:27 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-03-13 03:48:27 +0000 |
commit | fa64659e9342eae11dc81f43fcc041be12315cb8 (patch) | |
tree | ab089a38c8fab6055f60b8a8aacfcf4e30d5ba8c /capture_opts.c | |
parent | 07e797272eff7732a92e65fc40936fe7387c4fd4 (diff) | |
download | wireshark-fa64659e9342eae11dc81f43fcc041be12315cb8.tar.gz wireshark-fa64659e9342eae11dc81f43fcc041be12315cb8.tar.bz2 wireshark-fa64659e9342eae11dc81f43fcc041be12315cb8.zip |
Closing a capture file has nothing to do with the list of interfaces on
which to do a live capture; don't clear the latter list when closing the
capture file.
collect_ifaces() should clear out the existing list of interfaces before
filling that list up with the interfaces selected by the user. In
addition, when it frees up interfaces in that list, it should free up
the strings attached to those interfaces.
svn path=/trunk/; revision=41517
Diffstat (limited to 'capture_opts.c')
-rw-r--r-- | capture_opts.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/capture_opts.c b/capture_opts.c index f2ee8245bf..64749fb91d 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -975,6 +975,25 @@ collect_ifaces(capture_options *capture_opts) guint i; interface_t device; interface_options interface_opts; + + /* Empty out the existing list of interfaces. */ + for (i = capture_opts->ifaces->len; i != 0; i--) { + interface_opts = g_array_index(capture_opts->ifaces, interface_options, i - 1); + g_free(interface_opts.name); + g_free(interface_opts.descr); + g_free(interface_opts.cfilter); +#ifdef HAVE_PCAP_REMOTE + if (interface_opts.src_type == CAPTURE_IFREMOTE) { + g_free(interface_opts.remote_host); + g_free(interface_opts.remote_port); + g_free(interface_opts.auth_username); + g_free(interface_opts.auth_password); + } +#endif + capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i - 1); + } + + /* Now fill the list up again. */ for (i = 0; i < capture_opts->all_ifaces->len; i++) { device = g_array_index(capture_opts->all_ifaces, interface_t, i); if (!device.hidden && device.selected) { |