changeset 25591:324cd6544a7b

* fixing memory related bug; forgotton to duplicate some data which otherwise may be deleted by other parts of the program
author Tobias Markmann <tfar@soc.pidgin.im>
date Tue, 15 Jul 2008 21:26:51 +0000
parents 7f6558c7a0a3
children 6606566f15ff
files libpurple/protocols/jabber/caps.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c	Tue Jul 15 15:38:15 2008 +0000
+++ b/libpurple/protocols/jabber/caps.c	Tue Jul 15 21:26:51 2008 +0000
@@ -201,27 +201,27 @@
 	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 @@
 	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);