libpurple/protocols/myspace/user.c

branch
release-2.2.2
changeset 20256
5194cfc606e0
parent 20198
90ae53934c28
child 21076
bb293a21ce84
--- a/libpurple/protocols/myspace/user.c	Sun Oct 21 05:04:44 2007 +0000
+++ b/libpurple/protocols/myspace/user.c	Sun Oct 21 05:05:38 2007 +0000
@@ -99,10 +99,12 @@
 
 	if (full) {
 		/* TODO: link to username, if available */
-		char *profile = g_strdup_printf("<a href=\"http://myspace.com/%d\">http://myspace.com/%d</a>",
-				uid, uid);
-		purple_notify_user_info_add_pair(user_info, _("Profile"), profile);
-		g_free(profile);
+		if (uid) {
+			char *profile = g_strdup_printf("<a href=\"http://myspace.com/%d\">http://myspace.com/%d</a>",
+											uid, uid);
+			purple_notify_user_info_add_pair(user_info, _("Profile"), profile);
+			g_free(profile);
+		}
 	}
 
 
@@ -189,6 +191,14 @@
 		/* Ignore because PurpleBuddy knows this already */
 		;
 	} else if (g_str_equal(key_str, "ImageURL") || g_str_equal(key_str, "AvatarURL")) {
+		if (user->temporary_user) {
+			/* This user will be destroyed soon; don't try to look up its image or avatar, 
+			 * since that won't return immediately and we will end up accessing freed data.
+			 */
+			g_free(value_str);
+			return;
+		}
+		
 		const gchar *previous_url;
 
 		user->image_url = g_strdup(value_str);

mercurial