Fix a use after free that scanbuild detected release-2.x.y

Tue, 01 Jun 2021 20:16:06 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 01 Jun 2021 20:16:06 -0500
branch
release-2.x.y
changeset 40909
53938c5a6e15
parent 40908
8b3be4e34e27
child 40910
85104fd731b5

Fix a use after free that scanbuild detected

Testing Done:
Verified that scanbuild no longer detects the error.

Reviewed at https://reviews.imfreedom.org/r/701/

libpurple/protocols/bonjour/mdns_common.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/bonjour/mdns_common.c	Tue Jun 01 20:15:16 2021 -0500
+++ b/libpurple/protocols/bonjour/mdns_common.c	Tue Jun 01 20:16:06 2021 -0500
@@ -141,8 +141,8 @@
 		kvp = lst->data;
 		g_free(kvp->key);
 		g_free(kvp->value);
+		lst = g_slist_remove(lst, lst->data);
 		g_free(kvp);
-		lst = g_slist_remove(lst, lst->data);
 	}
 }
 

mercurial