changeset 19351:5461821ac122

g_memdup() the icon data before setting it as the buddy icon. Closes #2725.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Thu, 23 Aug 2007 06:02:54 +0000
parents 8839775bad3e
children 93f01e37d9f1
files libpurple/protocols/myspace/myspace.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Thu Aug 23 04:43:04 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Thu Aug 23 06:02:54 2007 +0000
@@ -1784,7 +1784,7 @@
 	return rc;
 }
 
-/* Process an incoming media (buddy icon) message. */
+/* Process an incoming media (message background?) message. */
 static gboolean
 msim_incoming_media(MsimSession *session, MsimMessage *msg)
 {
@@ -2656,11 +2656,18 @@
 	purple_debug_info("msim_downloaded_buddy_icon",
 			"Downloaded %d bytes\n", len);
 
+	if (!url_text) {
+		purple_debug_info("msim_downloaded_buddy_icon",
+				"failed to download icon for %s",
+				user->buddy->name);
+		return;
+	}
+
 	purple_buddy_icons_set_for_user(user->buddy->account,
 			user->buddy->name,
-			(gchar *)url_text, len, 
-			/*  Use URL itself as buddy icon "checksum" */
-			user->image_url);
+			g_memdup((gchar *)url_text, len), len, 
+			/* Use URL itself as buddy icon "checksum" (TODO: ETag) */
+			user->image_url);		/* checksum */
 }
 
 /** Store a field of information about a buddy. */