/pidgin/main: a1592c87b972: Remove some unnecessary g_object_(un...

Ankit Vani a at nevitus.org
Sat Jan 25 15:43:07 EST 2014


Changeset: a1592c87b9721937e07317799967ddc30f0e72bf
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-01-26 02:09 +0530
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/a1592c87b972

Description:

Remove some unnecessary g_object_(un)ref's, and relocate one to avoid a possible leak

diffstat:

 libpurple/protocols/jabber/caps.c |  8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diffs (53 lines):

diff --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c
--- a/libpurple/protocols/jabber/caps.c
+++ b/libpurple/protocols/jabber/caps.c
@@ -469,6 +469,7 @@ jabber_caps_client_iqcb(JabberStream *js
 			hasher = purple_md5_hash_new();
 		}
 		hash = jabber_caps_calculate_hash(info, hasher);
+		g_object_unref(hasher);
 
 		if (!hash || !g_str_equal(hash, userdata->ver)) {
 			purple_debug_warning("jabber", "Could not validate caps info from "
@@ -484,7 +485,6 @@ jabber_caps_client_iqcb(JabberStream *js
 		}
 
 		g_free(hash);
-		g_object_unref(hasher);
 	}
 
 	if (!userdata->hash && userdata->node_exts) {
@@ -814,7 +814,6 @@ static void
 append_escaped_string(PurpleHash *hash, const gchar *str)
 {
 	g_return_if_fail(hash != NULL);
-	g_object_ref(hash);
 
 	if (str && *str) {
 		char *tmp = g_markup_escape_text(str, -1);
@@ -823,7 +822,6 @@ append_escaped_string(PurpleHash *hash, 
 	}
 
 	purple_hash_append(hash, (const guchar *)"<", 1);
-	g_object_unref(hash);
 }
 
 gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, PurpleHash *hash)
@@ -836,8 +834,6 @@ gchar *jabber_caps_calculate_hash(Jabber
 	if (!info || !hash)
 		return NULL;
 
-	g_object_ref(hash);
-
 	/* sort identities, features and x-data forms */
 	info->identities = g_list_sort(info->identities, jabber_identity_compare);
 	info->features = g_list_sort(info->features, (GCompareFunc)strcmp);
@@ -913,8 +909,6 @@ gchar *jabber_caps_calculate_hash(Jabber
 	success = purple_hash_digest(hash, checksum, checksum_size);
 	checksum_size = purple_hash_get_digest_size(hash);
 
-	g_object_unref(hash);
-
 	return (success ? purple_base64_encode(checksum, checksum_size) : NULL);
 }
 



More information about the Commits mailing list