soc.2008.xmpp: 5bea85ed: * fixing memory related bug; forgotton t...

Daniel Atallah daniel.atallah at gmail.com
Wed Jul 16 00:15:12 EDT 2008


On Tue, Jul 15, 2008 at 5:30 PM,  <tfar at soc.pidgin.im> wrote:
> -----------------------------------------------------------------
> Revision: 5bea85ed5cacfcd03bbc34b9ee3b1f235f392842
> Ancestor: ba5f0e7f8074e5390b904e95f6194688dbbe815a
> Author: tfar at soc.pidgin.im
> Date: 2008-07-15T21:26:51
> Branch: im.pidgin.soc.2008.xmpp
> URL: http://d.pidgin.im/viewmtn/revision/info/5bea85ed5cacfcd03bbc34b9ee3b1f235f392842
>
> Modified files:
>        libpurple/protocols/jabber/caps.c
>
> ChangeLog:
>
> * fixing memory related bug; forgotton to duplicate some data which otherwise may be deleted by other parts of the program
>
>
> ============================================================
> --- libpurple/protocols/jabber/caps.c   8bdd8dc587f05ecbe26307874f8ca30ca8c369d7
> +++ libpurple/protocols/jabber/caps.c   acd1357fbcdc19cb7ad0dbb9c9c1c14f35c71e02
> @@ -201,27 +201,27 @@ static void jabber_caps_store_client(gpo
>        xmlnode *client = xmlnode_new_child(root,"client");
>        GList *iter;
>
> -       xmlnode_set_attrib(client,"node",clientinfo->node);
> -       xmlnode_set_attrib(client,"ver",clientinfo->ver);
> -       xmlnode_set_attrib(client,"hash",clientinfo->hash);
> +       xmlnode_set_attrib(client,"node",g_strdup(clientinfo->node));
> +       xmlnode_set_attrib(client,"ver",g_strdup(clientinfo->ver));
> +       xmlnode_set_attrib(client,"hash",g_strdup(clientinfo->hash));

This will leak; xmlnode_set_attrib() doesn't assume ownership of the
value, it g_strdup()s it internally.  The previous behavior was
correct.

-D




More information about the Devel mailing list