diff libpurple/protocols/myspace/user.c @ 21418:38cc722159ff

propagate from branch 'im.pidgin.pidgin' (head d8103be97302efb404e2f6922925f661c807ad23) to branch 'im.pidgin.cpw.resiak.disconnectreason' (head 0ac25a1f38ae28654c967caa143f1c0d12ef2e1c)
author Will Thompson <will.thompson@collabora.co.uk>
date Sat, 10 Nov 2007 12:10:04 +0000
parents 3f8b32a4786c
children e808d83d797e
line wrap: on
line diff
--- a/libpurple/protocols/myspace/user.c	Wed Nov 07 11:23:03 2007 +0000
+++ b/libpurple/protocols/myspace/user.c	Sat Nov 10 12:10:04 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);
+		}
 	}
 
 
@@ -203,6 +205,22 @@
 	} else if (g_str_equal(key_str, "ImageURL") || g_str_equal(key_str, "AvatarURL")) {
 		const gchar *previous_url;
 
+		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;
+		}
+
+		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;
+		}
+
 		g_free(user->image_url);
 
 		user->image_url = value_str;
@@ -215,7 +233,7 @@
 				NULL, 0, NULL);
 			return;
 		}
-	
+
 		/* TODO: use ETag for checksum */
 		previous_url = purple_buddy_icons_get_checksum_for_user(user->buddy);