Revision 12df03445c45ddd504a76c52aa7a78e633426dbe

Etan S. C. Reisner deryni at unreliablesource.net
Tue Feb 13 19:56:14 EST 2007


On Tue, Feb 13, 2007 at 07:03:29PM -0500, evands at pidgin.im wrote:
> -----------------------------------------------------------------
> Revision: 12df03445c45ddd504a76c52aa7a78e633426dbe
> Ancestor: ea62eb0f88d3efd1b661fe28edbc1d6c964cc05d
> Author: evands at pidgin.im
> Date: 2007-02-13T22:19:26
> Branch: im.pidgin.pidgin
> 
> Modified files:
>         libpurple/protocols/jabber/buddy.c
>         libpurple/protocols/jabber/roster.c
> 
> ChangeLog: 
> 
> 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.
> 

<snip>

> ============================================================
> --- libpurple/protocols/jabber/roster.c	9dd729caa6361d3cdda58d8132f12167a7304010
> +++ libpurple/protocols/jabber/roster.c	3c86f0f99618878658519a2881d9e5fef89d89d7
> @@ -176,7 +176,7 @@ void jabber_roster_parse(JabberStream *j
>  			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,

jabber_normalize returns a static buffer, two calls to jabber_normalize
can't exist at the same time. So I'm pretty sure that
g_utf8_collate(jid_norm, jabber_normalize(js->gc->account, username));
isn't going to do what you want if jid_norm isn't strdup:ed.

    -Etan


More information about the Cabal mailing list