aboutsummaryrefslogtreecommitdiffstats
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
parent8fee04ab512e957f3e5a1bc371fe4601eb8ba5a9 (diff)
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>
-rw-r--r--extcap.c24
-rw-r--r--extcap_parser.c5
2 files changed, 16 insertions, 13 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;
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) {