im.pidgin.pidgin: 9d22bc3a3d82cb26e7196d41b472b81c7660274d

jeff2 at soc.pidgin.im jeff2 at soc.pidgin.im
Mon Jan 28 21:00:48 EST 2008


-----------------------------------------------------------------
Revision: 9d22bc3a3d82cb26e7196d41b472b81c7660274d
Ancestor: 03e06749761ecfb8047770b6510ea4ba297fcaf6
Author: jeff2 at soc.pidgin.im
Date: 2008-01-29T01:51:01
Branch: im.pidgin.pidgin

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

ChangeLog: 

In msim_uid2username_from_blist(), return a static string as the documentation 
indicates, instead of a string that needs to be freed. Also free the username
in msim_add_contacts_from_server_cb(), which is copied from the return value
of msim_uid2username_from_blist().

Fixes #4737.

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/myspace.c	c8d5fbe03139fe0d75dc6d79b5d3c3624c29c009
+++ libpurple/protocols/myspace/myspace.c	7b76a0f8faf42457a8b30390e473e8a21f2f116b
@@ -1223,16 +1223,15 @@ msim_incoming_resolved(MsimSession *sess
  *
  * @param wanted_uid
  *
- * @return Username of wanted_uid, if on blist, or NULL. Static string.
- * 	TODO: The username string here is a new string from g_strdup(), not
- * 	a static string that doesn't need to be fixed. Probably leaks. TODO: fix.
+ * @return Username of wanted_uid, if on blist, or NULL. 
+ * 	This is a static string, so don't free it. Copy it if needed.
  *
  */
 static const gchar *
 msim_uid2username_from_blist(PurpleAccount *account, guint wanted_uid)
 {
 	GSList *buddies, *cur;
-	gchar *ret;
+	const gchar *ret;
 
 	buddies = purple_find_buddies(account, NULL); 
 
@@ -1258,7 +1257,7 @@ msim_uid2username_from_blist(PurpleAccou
 
 		if (uid == wanted_uid)
 		{
-			ret = g_strdup(name);
+			ret = name;
 			break;
 		}
 	}
@@ -2822,8 +2821,9 @@ msim_add_contact_from_server_cb(MsimSess
 	msim_store_user_info(session, contact_info, NULL);
 
 	/* TODO: other fields, store in 'user' */
+	msim_msg_free(contact_info);
 
-	msim_msg_free(contact_info);
+	g_free(username);
 }
 
 /** Add first ContactID in contact_info to buddy's list. Used to add


More information about the Commits mailing list