Mercurial > pidgin-twitter
changeset 93:7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sun, 06 Jul 2008 20:02:34 +0900 |
parents | 7f20a61e98ad |
children | 31cddb2c2acc |
files | pidgin-twitter.c |
diffstat | 1 files changed, 24 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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