/pidgin/main: 5aecb81f23ab: Fix memory leaks in Gadu-Gadu prpl. ...

Tomasz Wasilczyk twasilczyk at pidgin.im
Wed Mar 12 17:57:05 EDT 2014


Changeset: 5aecb81f23abaa29d2e750cce3162481d0722e40
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-03-12 22:56 +0100
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/5aecb81f23ab

Description:

Fix memory leaks in Gadu-Gadu prpl. Fixes #16129

diffstat:

 libpurple/protocols/gg/roster.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (48 lines):

diff --git a/libpurple/protocols/gg/roster.c b/libpurple/protocols/gg/roster.c
--- a/libpurple/protocols/gg/roster.c
+++ b/libpurple/protocols/gg/roster.c
@@ -366,7 +366,7 @@ void ggp_roster_group_buddy(PurpleConnec
 	const char *old_group, const char *new_group)
 {
 	ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc);
-	ggp_roster_change *change = g_new0(ggp_roster_change, 1);
+	ggp_roster_change *change;
 
 	if (!ggp_roster_enabled())
 		return;
@@ -378,6 +378,7 @@ void ggp_roster_group_buddy(PurpleConnec
 		who, old_group, new_group);
 
 	/* purple_blist_find_buddy(..., who) is not accessible at this moment */
+	change = g_new0(ggp_roster_change, 1);
 	change->type = GGP_ROSTER_CHANGE_CONTACT_UPDATE;
 	change->data.uin = ggp_str_to_uin(who);
 	rdata->pending_updates = g_list_append(rdata->pending_updates, change);
@@ -387,11 +388,12 @@ void ggp_roster_rename_group(PurpleConne
 	PurpleGroup *group, GList *moved_buddies)
 {
 	ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc);
-	ggp_roster_change *change = g_new0(ggp_roster_change, 1);
+	ggp_roster_change *change;
 
 	if (!ggp_roster_enabled())
 		return;
 
+	change = g_new0(ggp_roster_change, 1);
 	change->type = GGP_ROSTER_CHANGE_GROUP_RENAME;
 	change->data.group_rename.old_name = g_strdup(old_name);
 	change->data.group_rename.new_name =
@@ -415,11 +417,12 @@ void ggp_roster_remove_buddy(PurpleConne
 	PurpleGroup *group)
 {
 	ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc);
-	ggp_roster_change *change = g_new0(ggp_roster_change, 1);
+	ggp_roster_change *change;
 
 	if (!ggp_roster_enabled())
 		return;
 
+	change = g_new0(ggp_roster_change, 1);
 	change->type = GGP_ROSTER_CHANGE_CONTACT_REMOVE;
 	change->data.uin = ggp_str_to_uin(purple_buddy_get_name(buddy));
 	rdata->pending_updates = g_list_append(rdata->pending_updates, change);



More information about the Commits mailing list