wsutil: fix bugs in plugins_cleanup().

If plugin_list was NULL, plugin_types didn't get cleaned.
Add test and set of open_info_arr.

Change-Id: I7669e3ba86039fb2b26ff2da64f51896053c5e68
Reviewed-on: https://code.wireshark.org/review/20195
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Dario Lombardo 2017-02-20 14:05:15 +01:00 committed by Michael Mann
parent dcfc288130
commit 2de30dd18d
2 changed files with 12 additions and 12 deletions

View File

@ -2724,13 +2724,14 @@ cleanup_open_routines(void)
guint i;
struct open_info *i_open;
if (open_routines != NULL) {
if (open_routines != NULL && open_info_arr) {
for (i = 0, i_open = open_routines; i < open_info_arr->len; i++, i_open++) {
if (i_open->extensions != NULL)
g_strfreev(i_open->extensions_set);
}
g_array_free(open_info_arr, TRUE);
open_info_arr = NULL;
}
}

View File

@ -438,21 +438,20 @@ plugins_cleanup(void)
plugin* prev;
plugin* cur;
if (!plugin_list)
return;
if (plugin_list) {
prev = plugin_list;
cur = plugin_list->next;
prev = plugin_list;
cur = plugin_list->next;
do {
g_free(prev->name);
g_free(prev);
prev = cur;
cur = cur->next;
} while(cur);
do {
g_free(prev->name);
g_free(prev);
prev = cur;
cur = cur->next;
} while(cur);
g_free(prev->name);
g_free(prev);
}
g_slist_foreach(plugin_types, free_plugin_type, NULL);
g_slist_free(plugin_types);