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

tfar at soc.pidgin.im tfar at soc.pidgin.im
Tue Jul 15 17:30:43 EDT 2008


-----------------------------------------------------------------
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

-------------- next part --------------
============================================================
--- 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));
 	for(iter = props->identities; iter; iter = g_list_next(iter)) {
 		JabberCapsIdentity *id = iter->data;
 		xmlnode *identity = xmlnode_new_child(client, "identity");
-		xmlnode_set_attrib(identity, "category", id->category);
-		xmlnode_set_attrib(identity, "type", id->type);
+		xmlnode_set_attrib(identity, "category", g_strdup(id->category));
+		xmlnode_set_attrib(identity, "type", g_strdup(id->type));
 		if (id->name)
-			xmlnode_set_attrib(identity, "name", id->name);
+			xmlnode_set_attrib(identity, "name", g_strdup(id->name));
 	}
 
 	for(iter = props->features; iter; iter = g_list_next(iter)) {
 		const char *feat = iter->data;
 		xmlnode *feature = xmlnode_new_child(client, "feature");
-		xmlnode_set_attrib(feature, "var", feat);
+		xmlnode_set_attrib(feature, "var", g_strdup(feat));
 	}
 	
 	for(iter = props->forms; iter; iter = g_list_next(iter)) {
 		xmlnode *xdata = iter->data;
-		xmlnode_insert_child(client, xdata);
+		xmlnode_insert_child(client, xmlnode_copy(xdata));
 	}
 }
 
@@ -529,9 +529,9 @@ void jabber_caps_get_info(JabberStream *
 	userdata->ver = g_strdup(ver);
 	userdata->hash = g_strdup(hash);
 
-	key->node = (char *)node;
-	key->ver = (char *)ver;
-	key->hash = (char*)hash;
+	key->node = g_strdup(node);
+	key->ver = g_strdup(ver);
+	key->hash = g_strdup(hash);
 	
 	client = g_hash_table_lookup(capstable, key);
 


More information about the Commits mailing list