extcap: remove potential leak.

Found by clang.

Change-Id: I84359a2f7985bca8b0089200b3c37d04e06effe2
Reviewed-on: https://code.wireshark.org/review/35354
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Tomasz Moń <desowin@gmail.com>
This commit is contained in:
Dario Lombardo 2019-12-08 18:33:45 +01:00 committed by Tomasz Moń
parent effe6ddaca
commit 1cd1e36a05
1 changed files with 11 additions and 3 deletions

View File

@ -320,14 +320,15 @@ extcap_if_executable(const gchar *ifname)
return interface != NULL ? interface->extcap_path : NULL;
}
static void
static gboolean
extcap_iface_toolbar_add(const gchar *extcap, iface_toolbar *toolbar_entry)
{
char *toolname;
gboolean ret = FALSE;
if (!extcap || !toolbar_entry)
{
return;
return ret;
}
toolname = g_path_get_basename(extcap);
@ -335,9 +336,11 @@ extcap_iface_toolbar_add(const gchar *extcap, iface_toolbar *toolbar_entry)
if (!g_hash_table_lookup(_toolbars, toolname))
{
g_hash_table_insert(_toolbars, g_strdup(toolname), toolbar_entry);
ret = TRUE;
}
g_free(toolname);
return ret;
}
static gchar **
@ -1863,9 +1866,14 @@ process_new_extcap(const char *extcap, char *output)
if (toolbar_entry && toolbar_entry->menu_title)
{
iface_toolbar_add(toolbar_entry);
extcap_iface_toolbar_add(extcap, toolbar_entry);
if (!extcap_iface_toolbar_add(extcap, toolbar_entry))
{
extcap_free_toolbar(toolbar_entry);
toolbar_entry = NULL;
}
}
extcap_free_toolbar(toolbar_entry);
g_list_foreach(interfaces, remove_extcap_entry, NULL);
g_list_free(interfaces);
g_list_free(interface_keys);