wsutil: fix a NULL pointer dereference when there is a single plugin registered
Rework loop to avoid dereferencing a NULL pointer. Bug introduced in g6d79055 Change-Id: I88a9f2d045b633cc2365ff6ce939f3315e7d42cc Reviewed-on: https://code.wireshark.org/review/20751 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
2141eafa64
commit
cabd7d8293
|
@ -435,22 +435,12 @@ free_plugin_type(gpointer p, gpointer user_data _U_)
|
|||
void
|
||||
plugins_cleanup(void)
|
||||
{
|
||||
plugin* prev;
|
||||
plugin* cur;
|
||||
plugin* cur, *next;
|
||||
|
||||
if (plugin_list) {
|
||||
prev = plugin_list;
|
||||
cur = plugin_list->next;
|
||||
|
||||
do {
|
||||
g_free(prev->name);
|
||||
g_free(prev);
|
||||
prev = cur;
|
||||
cur = cur->next;
|
||||
} while(cur);
|
||||
|
||||
g_free(prev->name);
|
||||
g_free(prev);
|
||||
for (cur = plugin_list; cur != NULL; cur = next) {
|
||||
next = cur->next;
|
||||
g_free(cur->name);
|
||||
g_free(cur);
|
||||
}
|
||||
|
||||
g_slist_foreach(plugin_types, free_plugin_type, NULL);
|
||||
|
|
Loading…
Reference in New Issue