/soc/2013/ankitkv/gobjectification: 427725f8ed54: Free strings r...

Ankit Vani a at nevitus.org
Sun Jul 14 05:39:06 EDT 2013


Changeset: 427725f8ed54234182199be99c758bc712f26b8c
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-14 15:08 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/427725f8ed54

Description:

Free strings received from g_object_get

diffstat:

 libpurple/account.c           |  8 +++++++-
 libpurple/buddylist.c         |  2 ++
 libpurple/conversationtypes.c |  2 ++
 pidgin/gtkblist.c             |  6 ++++--
 pidgin/gtkutils.c             |  5 ++++-
 5 files changed, 19 insertions(+), 4 deletions(-)

diffs (126 lines):

diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -2921,8 +2921,11 @@ purple_account_constructed(GObject *obje
 			account);
 
 	prpl = purple_find_prpl(protocol_id);
-	if (prpl == NULL)
+	if (prpl == NULL) {
+		g_free(username);
+		g_free(protocol_id);
 		return;
+	}
 
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 	if (prpl_info != NULL && prpl_info->status_types != NULL)
@@ -2941,6 +2944,9 @@ purple_account_constructed(GObject *obje
 		purple_presence_set_status_active(priv->presence,
 										"offline",
 										TRUE);
+
+	g_free(username);
+	g_free(protocol_id);
 }
 
 /* GObject dispose function */
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -237,6 +237,7 @@ contact_to_xmlnode(PurpleContact *contac
 	g_hash_table_foreach(purple_blist_node_get_settings(PURPLE_BLIST_NODE(contact)),
 			value_to_xmlnode, node);
 
+	g_free(alias);
 	return node;
 }
 
@@ -267,6 +268,7 @@ chat_to_xmlnode(PurpleChat *chat)
 	g_hash_table_foreach(purple_blist_node_get_settings(PURPLE_BLIST_NODE(chat)),
 			value_to_xmlnode, node);
 
+	g_free(alias);
 	return node;
 }
 
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -444,6 +444,8 @@ purple_im_conversation_constructed(GObje
 
 	if (purple_prefs_get_bool("/purple/logging/log_ims"))
 		purple_conversation_set_logging(PURPLE_CONVERSATION(im), TRUE);
+
+	g_free(name);
 }
 
 /* GObject dispose function */
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -627,6 +627,7 @@ static void gtk_blist_renderer_edited_cb
 		purple_chat_set_alias(PURPLE_CHAT(node), arg2);
 	}
 
+	g_free(alias);
 	pidgin_blist_refresh(list);
 }
 
@@ -3921,11 +3922,10 @@ static char *pidgin_get_tooltip_text(Pur
 					purple_account_get_username(purple_buddy_get_account(b)));
 		}
 
-		g_object_get(c, "alias", &alias, NULL);
-
 		/* Alias */
 		/* If there's not a contact alias, the node is being displayed with
 		 * this alias, so there's no point in showing it in the tooltip. */
+		g_object_get(c, "alias", &alias, NULL);
 		if (full && c && purple_buddy_get_local_alias(b) != NULL && purple_buddy_get_local_alias(b)[0] != '\0' &&
 		    (alias != NULL && alias[0] != '\0') &&
 		    strcmp(alias, purple_buddy_get_local_alias(b)) != 0)
@@ -4068,6 +4068,7 @@ static char *pidgin_get_tooltip_text(Pur
 
 		purple_notify_user_info_destroy(user_info);
 	}
+	g_free(alias);
 
 	purple_signal_emit(pidgin_blist_get_handle(), "drawing-tooltip",
 	                   node, str, full);
@@ -4515,6 +4516,7 @@ pidgin_blist_get_name_markup(PurpleBuddy
 	g_free(nametext);
 	g_free(statustext);
 	g_free(idletime);
+	g_free(contact_alias);
 
 	if (hidden_conv) {
 		char *tmp = text;
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -1982,6 +1982,8 @@ add_completion_list(PidginCompletionData
 			if (!PURPLE_IS_CONTACT(cnode))
 				continue;
 
+			g_object_get(cnode, "alias", &alias, NULL);
+
 			for (bnode = cnode->child; bnode != NULL; bnode = bnode->next)
 			{
 				PidginBuddyCompletionEntry entry;
@@ -1989,7 +1991,6 @@ add_completion_list(PidginCompletionData
 				entry.entry.buddy = (PurpleBuddy *) bnode;
 
 				if (filter_func(&entry, user_data)) {
-					g_object_get(cnode, "alias", &alias, NULL);
 					add_buddyname_autocomplete_entry(data->store,
 														alias,
 														purple_buddy_get_contact_alias(entry.entry.buddy),
@@ -1998,6 +1999,8 @@ add_completion_list(PidginCompletionData
 													 );
 				}
 			}
+
+			g_free(alias);
 		}
 	}
 



More information about the Commits mailing list