# HG changeset patch # User Jeffrey Connelly # Date 1201571461 0 # Node ID 9f95357c21b9ccff619d8e66bae4c476c1839953 # Parent d2fc168b5e7a41edbdfc9e6e29839d6eacf81e42 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. diff -r d2fc168b5e7a -r 9f95357c21b9 libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Sun Jan 27 21:37:43 2008 +0000 +++ b/libpurple/protocols/myspace/myspace.c Tue Jan 29 01:51:01 2008 +0000 @@ -1223,16 +1223,15 @@ * * @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 @@ if (uid == wanted_uid) { - ret = g_strdup(name); + ret = name; break; } } @@ -2822,8 +2821,9 @@ msim_store_user_info(session, contact_info, NULL); /* TODO: other fields, store in 'user' */ - msim_msg_free(contact_info); + + g_free(username); } /** Add first ContactID in contact_info to buddy's list. Used to add