/pidgin/main: 9f60a81a9c41: Backported from 3.0.0-devel:
Andrew Victor
andrew.victor at mxit.com
Sat Jul 28 18:48:59 EDT 2012
Changeset: 9f60a81a9c4125c2b9c46ba9c15ebf71dd586e89
Author: Andrew Victor <andrew.victor at mxit.com>
Date: 2012-07-28 23:57 +0200
Branch: mxit-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/9f60a81a9c41
Description:
Backported from 3.0.0-devel:
Need to make a copy of the data passed to purple_imgstore_add_with_id().
(Ref: http://pidgin.im/pipermail/commits/2011-September/019910.html)
diffstat:
libpurple/protocols/mxit/formcmds.c | 9 ++-------
libpurple/protocols/mxit/protocol.c | 4 ++--
2 files changed, 4 insertions(+), 9 deletions(-)
diffs (45 lines):
diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c
--- a/libpurple/protocols/mxit/formcmds.c
+++ b/libpurple/protocols/mxit/formcmds.c
@@ -86,7 +86,6 @@ struct ii_url_request
static void mxit_cb_ii_returned(PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message)
{
struct ii_url_request* iireq = (struct ii_url_request*) user_data;
- char* ii_data;
int* intptr = NULL;
int id;
@@ -106,12 +105,8 @@ static void mxit_cb_ii_returned(PurpleUt
goto done;
}
- /* make a copy of the data */
- ii_data = g_malloc(len);
- memcpy(ii_data, (const char*) url_text, len);
-
- /* we now have the inline image, store it in the imagestore */
- id = purple_imgstore_add_with_id(ii_data, len, NULL);
+ /* we now have the inline image, store a copy in the imagestore */
+ id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL);
/* map the inline image id to purple image id */
intptr = g_malloc(sizeof(int));
diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c
--- a/libpurple/protocols/mxit/protocol.c
+++ b/libpurple/protocols/mxit/protocol.c
@@ -2168,13 +2168,13 @@ static void mxit_parse_cmd_media( struct
contact = get_mxit_invite_contact( session, chunk.mxitid );
if ( contact ) {
/* this is an invite (add image to the internal image store) */
- contact->imgid = purple_imgstore_add_with_id( chunk.data, chunk.length, NULL );
+ contact->imgid = purple_imgstore_add_with_id( g_memdup( chunk.data, chunk.length ), chunk.length, NULL );
/* show the profile */
mxit_show_profile( session, chunk.mxitid, contact->profile );
}
else {
/* this is a contact's avatar, so update it */
- purple_buddy_icons_set_for_user( session->acc, chunk.mxitid, g_memdup( chunk.data, chunk.length), chunk.length, chunk.avatarid );
+ purple_buddy_icons_set_for_user( session->acc, chunk.mxitid, g_memdup( chunk.data, chunk.length ), chunk.length, chunk.avatarid );
}
}
}
More information about the Commits
mailing list