# HG changeset patch # User Yoshiki Yazawa # Date 1215342154 -32400 # Node ID 7219f7dee52fa788910d40bcaffdd9537e104bcc # Parent 7f20a61e98adc241f5dcf06be82f4e93ba4f7ffa revised got_icon_cb() and fixed unexpected free hash table data. diff -r 7f20a61e98ad -r 7219f7dee52f pidgin-twitter.c --- a/pidgin-twitter.c Sun Jul 06 18:17:54 2008 +0900 +++ b/pidgin-twitter.c Sun Jul 06 20:02:34 2008 +0900 @@ -1233,30 +1233,36 @@ twitter_debug("unknown service\n"); } - if(data && data->fetch_data) { - data->fetch_data = NULL; + /* return if download failed */ + if(!url_text) { + twitter_debug("downloading %s's icon failed : %s\n", + user_name, error_message); + if(data) + data->requested = FALSE; + g_free(gotdata->user_name); + g_free(gotdata); + return; } - /* Return if user's icon had already been downloaded or - * the download failed. */ - if((data && data->icon_id) || !url_text) { //xxx - if(!url_text) { - twitter_debug("downloading %s's icon failed : %s\n", - user_name, error_message); + if(data) { + /* remove download request */ + data->requested = FALSE; + data->fetch_data = NULL; + + /* return if user's icon had been downloaded */ + if(data->icon_id > 0) { + twitter_debug("%s's icon has already been downloaded\n", + user_name); + g_free(gotdata->user_name); + g_free(gotdata); + return; } - else { - twitter_debug("%s's icon has already been downloaded\n", user_name); - } - - data->requested = FALSE; - - g_free(user_name); - return; } icon_id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, user_name); if(!data) { + twitter_debug("allocate icon_data (shouldn't be called)\n"); data = g_new0(icon_data, 1); } @@ -1315,8 +1321,8 @@ /* Insert the icon to messages that had been received. */ insert_requested_icon(user_name, service); - g_free(user_name); - g_free(data); + g_free(gotdata->user_name); + g_free(gotdata); } static void