summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-02-20 14:05:15 +0100
committerMichael Mann <mmann78@netscape.net>2017-02-26 18:00:23 +0000
commit2de30dd18d86ddd7dd0f5aab636f36d1f4a37cc1 (patch)
tree205adfabcafcfb0237bbab0359703241b3b67974
parentdcfc288130e0576249f3ba7f8db7ad1681ff70f5 (diff)
downloadwireshark-2de30dd18d86ddd7dd0f5aab636f36d1f4a37cc1.tar.gz
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>
-rw-r--r--wiretap/file_access.c3
-rw-r--r--wsutil/plugins.c21
2 files changed, 12 insertions, 12 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index 4448b36355..4e725afb0a 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -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;
}
}
diff --git a/wsutil/plugins.c b/wsutil/plugins.c
index 73d79f4b8e..d916c9cf77 100644
--- a/wsutil/plugins.c
+++ b/wsutil/plugins.c
@@ -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);