summaryrefslogtreecommitdiff
path: root/extcap.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2014-08-24 22:35:52 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2014-08-26 14:57:09 +0000
commite28f490426cd547fef74dc2bc37d426310d5b1ea (patch)
tree2c8a0079b50c4d812dce610d876cdd11e6be0cb8 /extcap.c
parent8fee04ab512e957f3e5a1bc371fe4601eb8ba5a9 (diff)
downloadwireshark-e28f490426cd547fef74dc2bc37d426310d5b1ea.tar.gz
Extcap: restore compatibility with GLib 2.16.0
While we are at it, fix what seem to be a memory leak in extcaps_init_initerfaces() Change-Id: I1bb9a1b44d16f986eedd192b15cce84c5881a917 Reviewed-on: https://code.wireshark.org/review/3820 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'extcap.c')
-rw-r--r--extcap.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/extcap.c b/extcap.c
index 73b04bf2ca..faded7bfa7 100644
--- a/extcap.c
+++ b/extcap.c
@@ -131,7 +131,7 @@ extcap_if_cleanup(void)
static void
extcap_if_add(gchar *ifname, gchar *extcap)
{
- if ( !g_hash_table_contains(ifaces, ifname) )
+ if ( g_hash_table_lookup(ifaces, ifname) == NULL )
g_hash_table_insert(ifaces, ifname, extcap);
}
@@ -473,7 +473,7 @@ extcaps_init_initerfaces(capture_options *capture_opts)
return FALSE;
/* Create extcap call */
- args = g_ptr_array_new_with_free_func(g_free);
+ args = g_ptr_array_new();
#define add_arg(X) g_ptr_array_add(args, g_strdup(X))
add_arg(interface_opts.extcap);
@@ -487,15 +487,17 @@ extcaps_init_initerfaces(capture_options *capture_opts)
add_arg(NULL);
#undef add_arg
- /* Wireshark for windows crashes here sometimes *
- * Access violation reading location 0x... */
- g_spawn_async(NULL, (gchar **)args->pdata, NULL,
- (GSpawnFlags) 0, NULL, NULL,
- &pid,NULL);
-
- interface_opts.extcap_pid = pid;
- capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i);
- g_array_insert_val(capture_opts->ifaces, i, interface_opts);
+ /* Wireshark for windows crashes here sometimes *
+ * Access violation reading location 0x... */
+ g_spawn_async(NULL, (gchar **)args->pdata, NULL,
+ (GSpawnFlags) 0, NULL, NULL,
+ &pid,NULL);
+
+ g_ptr_array_foreach(args, (GFunc)g_free, NULL);
+ g_ptr_array_free(args, TRUE);
+ interface_opts.extcap_pid = pid;
+ capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i);
+ g_array_insert_val(capture_opts->ifaces, i, interface_opts);
}
return TRUE;