aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.c
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2024-02-15 08:57:30 -0500
committerJohn Thacker <johnthacker@gmail.com>2024-02-15 08:57:30 -0500
commit5ed34995de2a5f95119a49c07b6e47509f525343 (patch)
treec2342a8db8bff9b7104972fe8e8aa1a0a14117c5 /extcap.c
parentf1d0622b4730d4166bf5ed574f5804d33a47d9b1 (diff)
extcap: Don't add args to a list just to destroy it
Allow cb_preference to take a NULL for the pointer to a list of arguments. If the pointer is NULL, then free the argument list. This keeps extcap_load_interface_list from creating a list that is immediately freed.
Diffstat (limited to 'extcap.c')
-rw-r--r--extcap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/extcap.c b/extcap.c
index d6a4f20c37..2775582550 100644
--- a/extcap.c
+++ b/extcap.c
@@ -935,7 +935,11 @@ static gboolean cb_preference(extcap_callback_info_t cb_info)
}
}
- *il = g_list_append(*il, arguments);
+ if (il) {
+ *il = g_list_append(*il, arguments);
+ } else {
+ extcap_free_arg_list(arguments);
+ }
/* By returning false, extcap_foreach will break on first found */
return TRUE;
@@ -2173,7 +2177,6 @@ extcap_load_interface_list(void)
int minor = 0;
guint count = 0;
extcap_run_extcaps_info_t *infos;
- GList *unused_arguments = NULL;
_loaded_interfaces = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, extcap_free_interface_info);
/* Cleanup lookup table */
@@ -2212,13 +2215,11 @@ extcap_load_interface_list(void)
extcap_callback_info_t cb_info = {
.ifname = iface_info->ifname,
.output = iface_info->output,
- .data = &unused_arguments,
+ .data = NULL,
};
cb_preference(cb_info);
}
}
- /* XXX rework cb_preference such that this unused list can be removed. */
- extcap_free_if_configuration(unused_arguments, TRUE);
extcap_free_extcaps_info_array(infos, count);
g_free(arg_version);
}