summaryrefslogtreecommitdiff
path: root/extcap_parser.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-12-11 11:42:28 +0100
committerAnders Broman <a.broman58@gmail.com>2015-12-19 23:23:59 +0000
commit7046b4b0840e106a1361f4fda8497eaeafe652dc (patch)
tree8b92be707c96af543170fc2ccbbcbd3711e11c55 /extcap_parser.c
parent07f0cf86333e7d2dd805731a322652ae5101a358 (diff)
downloadwireshark-7046b4b0840e106a1361f4fda8497eaeafe652dc.tar.gz
extcap: plug some memleaks
The working directory for g_spawn_sync should not be escaped, it is simply passed to chdir. The escaping was needed for the command, so do so (hmm... maybe the argv arguments should be escaped too for Windows). Also remove an unnecessary NULL command argument for extcap_foreach. Note: there is still a memleak when exiting because the ifaces table is not cleared after querying the list. Change-Id: I1251d623b954a81848044b6d1faf8dcec8ce465b Reviewed-on: https://code.wireshark.org/review/12530 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'extcap_parser.c')
-rw-r--r--extcap_parser.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/extcap_parser.c b/extcap_parser.c
index dc74b2588f..4228bc5bd3 100644
--- a/extcap_parser.c
+++ b/extcap_parser.c
@@ -256,6 +256,7 @@ void extcap_free_tokenized_sentence(extcap_token_sentence *s) {
extcap_free_tokenized_param(tv);
}
+ g_free(s);
}
void extcap_free_tokenized_sentence_list(extcap_token_sentence *f) {
@@ -427,14 +428,19 @@ extcap_interface *extcap_new_interface(void) {
}
void extcap_free_interface(extcap_interface *i) {
- if (i == NULL)
- return;
+ extcap_interface *next_i = i;
+
+ while (i) {
+ next_i = i->next_interface;
+ if (i->call != NULL)
+ g_free(i->call);
- if (i->call != NULL)
- g_free(i->call);
+ if (i->display != NULL)
+ g_free(i->display);
- if (i->display != NULL)
- g_free(i->display);
+ g_free(i);
+ i = next_i;
+ }
}
extcap_dlt *extcap_new_dlt(void) {