diff options
-rw-r--r-- | extcap.c | 24 | ||||
-rw-r--r-- | extcap_parser.c | 5 |
2 files changed, 16 insertions, 13 deletions
@@ -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; diff --git a/extcap_parser.c b/extcap_parser.c index 8fdbb1f0f5..29c9b9de9a 100644 --- a/extcap_parser.c +++ b/extcap_parser.c @@ -504,13 +504,14 @@ void extcap_free_arg(extcap_arg *a) { g_list_foreach(a->values, (GFunc) extcap_free_valuelist, NULL); } -static void extcap_free_arg_list_cb(gpointer listentry) { +static void extcap_free_arg_list_cb(gpointer listentry, gpointer data _U_) { if (listentry != NULL) extcap_free_arg((extcap_arg *) listentry); } void extcap_free_arg_list(GList *a) { - g_list_free_full(a, extcap_free_arg_list_cb); + g_list_foreach(a, extcap_free_arg_list_cb, NULL); + g_list_free(a); } static gint glist_find_numbered_arg(gconstpointer listelem, gconstpointer needle) { |