pidgin: 0bb43087: Fix a few small memleaks

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Dec 17 20:55:33 EST 2008


-----------------------------------------------------------------
Revision: 0bb430874c7ebe013414d3b52b6d7166a3a1c4d0
Ancestor: 82e4edbe06cb0ef0fa59f70db44a289bb91e1343
Author: markdoliner at pidgin.im
Date: 2008-12-18T01:53:49
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0bb430874c7ebe013414d3b52b6d7166a3a1c4d0

Modified files:
        libpurple/protocols/myspace/message.c
        libpurple/protocols/myspace/myspace.c
        libpurple/protocols/myspace/user.c

ChangeLog: 

Fix a few small memleaks

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/message.c	b0ea8730d74bb60bdd308f895e2b7b8f2a0fadad
+++ libpurple/protocols/myspace/message.c	3857bab70a12e1e1743d0007b0884d141cde57fd
@@ -1040,7 +1040,7 @@ msim_parse(const gchar *raw)
 			/* Incoming protocol messages get tagged as MSIM_TYPE_RAW, which
 			 * represents an untyped piece of data. msim_msg_get_* will
 			 * convert to appropriate types for caller, and handle unescaping if needed. */
-			msg = msim_msg_append(msg, g_strdup(key), MSIM_TYPE_RAW, g_strdup(value));
+			msg = msim_msg_append_dynamic_name(msg, g_strdup(key), MSIM_TYPE_RAW, g_strdup(value));
 #ifdef MSIM_DEBUG_PARSE
 			purple_debug_info("msim", "insert string: |%s|=|%s|\n", key, value);
 #endif
============================================================
--- libpurple/protocols/myspace/myspace.c	8af8dd0c572175a3f616bc2aa9752841ed4e4de4
+++ libpurple/protocols/myspace/myspace.c	9a16e6dcedc4af27fa1fd34709aa84c0f1c60560
@@ -1380,17 +1380,15 @@ msim_incoming_status(MsimSession *sessio
 	if (status_headline && strcmp(status_headline, "") != 0) {
 		/* The status headline is plaintext, but libpurple treats it as HTML,
 		 * so escape any HTML characters to their entity equivalents. */
-		status_headline_escaped = g_markup_escape_text(status_headline, strlen(status_headline));
+		status_headline_escaped = g_markup_escape_text(status_headline, -1);
 	} else {
 		status_headline_escaped = NULL;
 	}
 
 	g_free(status_headline);
 
-	if (user->headline)
-		g_free(user->headline);
-
 	/* don't copy; let the MsimUser own the headline, memory-wise */
+	g_free(user->headline);
 	user->headline = status_headline_escaped;
 
 	/* Set user status */
@@ -1421,7 +1419,6 @@ msim_incoming_status(MsimSession *sessio
 					status_code);
 			msim_unrecognized(session, NULL, unrecognized_msg);
 			g_free(unrecognized_msg);
-
 	}
 
 	purple_prpl_got_user_status(session->account, username, purple_primitive_get_id_from_type(purple_status_code), NULL);
============================================================
--- libpurple/protocols/myspace/user.c	729f5bc52b496d0fa54222fc913b19b3bc968ab7
+++ libpurple/protocols/myspace/user.c	454738270514715d39c6fd06efc40299d3ef4716
@@ -286,6 +286,7 @@ msim_store_user_info_each(const gchar *k
 	if (g_str_equal(key_str, "UserID") || g_str_equal(key_str, "ContactID")) {
 		/* Save to buddy list, if it exists, for quick cached uid lookup with msim_uid2username_from_blist(). */
 		user->id = atol(value_str);
+		g_free(value_str);
 		if (user->buddy)
 		{
 			purple_debug_info("msim", "associating uid %s with username %s\n", key_str, user->buddy->name);
@@ -303,13 +304,16 @@ msim_store_user_info_each(const gchar *k
 		user->location = value_str;
 	} else if (g_str_equal(key_str, "TotalFriends")) {
 		user->total_friends = atol(value_str);
+		g_free(value_str);
 	} else if (g_str_equal(key_str, "DisplayName")) {
 		g_free(user->display_name);
 		user->display_name = value_str;
 	} else if (g_str_equal(key_str, "BandName")) {
 		msim_set_artist_or_title(user, value_str, NULL);
+		g_free(value_str);
 	} else if (g_str_equal(key_str, "SongName")) {
 		msim_set_artist_or_title(user, NULL, value_str);
+		g_free(value_str);
 	} else if (g_str_equal(key_str, "UserName") || g_str_equal(key_str, "IMName") || g_str_equal(key_str, "NickName")) {
 		/* Ignore because PurpleBuddy knows this already */
 		g_free(value_str);


More information about the Commits mailing list