/pidgin/main: 658b4037b8f6: MXit: Rather use g_memdup() here tha...
Andrew Victor
andrew.victor at mxit.com
Wed Jan 16 04:39:52 EST 2013
Changeset: 658b4037b8f683b281cd2ac1542693bd28664092
Author: Andrew Victor <andrew.victor at mxit.com>
Date: 2013-01-16 11:18 +0200
Branch: release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/658b4037b8f6
Description:
MXit: Rather use g_memdup() here than allocating a buffer and copying the data ourselves.
diffstat:
libpurple/protocols/mxit/formcmds.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diffs (26 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));
More information about the Commits
mailing list