extcap: Fix a potential leak of memory pointed to by 'toolbar_entry'
Initialize toolbar_entry after error checking is done to avoid a potential memory leak when exiting early from cb_load_interfaces(). Change-Id: I925d9296085964c6d5c3a9ccae85137285bf9220 Reviewed-on: https://code.wireshark.org/review/28060 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
parent
e8493fa7c4
commit
26be931810
12
extcap.c
12
extcap.c
@ -1648,12 +1648,6 @@ static gboolean cb_load_interfaces(extcap_callback_info_t cb_info)
|
||||
/* Load interfaces from utility */
|
||||
interfaces = extcap_parse_interfaces(cb_info.output, &control_items);
|
||||
|
||||
if (control_items)
|
||||
{
|
||||
toolbar_entry = g_new0(iface_toolbar, 1);
|
||||
toolbar_entry->controls = control_items;
|
||||
}
|
||||
|
||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Loading interface list for %s ", cb_info.extcap);
|
||||
|
||||
/* Seems, that there where no interfaces to be loaded */
|
||||
@ -1680,6 +1674,12 @@ static gboolean cb_load_interfaces(extcap_callback_info_t cb_info)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (control_items)
|
||||
{
|
||||
toolbar_entry = g_new0(iface_toolbar, 1);
|
||||
toolbar_entry->controls = control_items;
|
||||
}
|
||||
|
||||
walker = interfaces;
|
||||
gchar* help = NULL;
|
||||
while (walker != NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user