# HG changeset patch # User Evan Schoenberg # Date 1171405166 0 # Node ID 0b16a4aa4e2b721c9e6cec3ea807a2e335d0c39f # Parent fc586f7f23bd6dd569f8bc292c736253325e01eb Fixed 3 Jabber memory leaks: in jabber_roster_parse(), there's no need to g_strdup() this normalized jid since it's only used immediately, and there was no correspoding g_free(). When removing an id from jbi->ids, its data should always be freed. Finally, gaim_str_seconds_to_string() returns retained memory -- we must free the returned pointer when we're done using it. diff -r fc586f7f23bd -r 0b16a4aa4e2b libpurple/protocols/jabber/buddy.c --- a/libpurple/protocols/jabber/buddy.c Tue Feb 13 05:02:05 2007 +0000 +++ b/libpurple/protocols/jabber/buddy.c Tue Feb 13 22:19:26 2007 +0000 @@ -642,7 +642,9 @@ } if(jbir) { if(jbir->idle_seconds > 0) { - gaim_notify_user_info_add_pair(user_info, _("Idle"), gaim_str_seconds_to_string(jbir->idle_seconds)); + char *idle = gaim_str_seconds_to_string(jbir->idle_seconds); + gaim_notify_user_info_add_pair(user_info, _("Idle"), idle); + g_free(idle); } } if(jbr && jbr->client.name) { @@ -680,7 +682,9 @@ if(jbir) { if(jbir->idle_seconds > 0) { - gaim_notify_user_info_add_pair(user_info, _("Idle"), gaim_str_seconds_to_string(jbir->idle_seconds)); + char *idle = gaim_str_seconds_to_string(jbir->idle_seconds); + gaim_notify_user_info_add_pair(user_info, _("Idle"), idle); + g_free(idle); } } if(jbr && jbr->client.name) { @@ -729,6 +733,7 @@ while(l) { if(!strcmp(id, l->data)) { jbi->ids = g_slist_remove(jbi->ids, l->data); + g_free(l->data); return; } l = l->next; diff -r fc586f7f23bd -r 0b16a4aa4e2b libpurple/protocols/jabber/roster.c --- a/libpurple/protocols/jabber/roster.c Tue Feb 13 05:02:05 2007 +0000 +++ b/libpurple/protocols/jabber/roster.c Tue Feb 13 22:19:26 2007 +0000 @@ -176,7 +176,7 @@ char *jid_norm; const char *username; - jid_norm = g_strdup(jabber_normalize(js->gc->account, jid)); + jid_norm = jabber_normalize(js->gc->account, jid); username = gaim_account_get_username(js->gc->account); me = g_utf8_collate(jid_norm, jabber_normalize(js->gc->account,