rewtguy/pidgin

Fix a use after free that scanbuild found
release-2.x.y
2021-06-01, Gary Kramlich
85104fd731b5
Parents 53938c5a6e15
Children b3c69b679399
Fix a use after free that scanbuild found

Testing Done:
Verified the erros were no longer detected by scanbuild.

Reviewed at https://reviews.imfreedom.org/r/702/
--- a/libpurple/blist.c Tue Jun 01 20:16:06 2021 -0500
+++ b/libpurple/blist.c Tue Jun 01 20:20:21 2021 -0500
@@ -1417,14 +1417,16 @@
g_free(buddy->server_alias);
PURPLE_DBUS_UNREGISTER_POINTER(buddy);
- g_free(buddy);
/* FIXME: Once PurpleBuddy is a GObject, timeout callbacks can
* g_object_ref() it when connecting the callback and
* g_object_unref() it in the handler. That way, it won't
* get freed while the timeout is pending and this line can
* be removed. */
- while (g_source_remove_by_user_data((gpointer *)buddy));
+ while (g_source_remove_by_user_data((gpointer *)buddy)) {
+ }
+
+ g_free(buddy);
}
void