about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-08-17 23:32:43 +0100
committerJames Booth <boothj5@gmail.com>2016-08-17 23:32:43 +0100
commit7b22c813c8daf7f080a098705394b4f70e0b818b (patch)
tree002dd92ed8fc86e0e9711e3e9de497e96d1e2c96
parent9945246a648998e374c0c3a5ac56cdffc63ef13a (diff)
downloadprofani-tty-7b22c813c8daf7f080a098705394b4f70e0b818b.tar.gz
Copy feature strings on caps_get_features
-rw-r--r--src/xmpp/capabilities.c6
-rw-r--r--src/xmpp/stanza.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c
index 6310352e..da74665b 100644
--- a/src/xmpp/capabilities.c
+++ b/src/xmpp/capabilities.c
@@ -113,17 +113,19 @@ caps_get_features(void)
 
     GList *curr = prof_features;
     while (curr) {
-        result = g_list_append(result, curr->data);
+        result = g_list_append(result, strdup(curr->data));
         curr = g_list_next(curr);
     }
 
     GList *plugin_features = plugins_get_disco_features();
     curr = plugin_features;
     while (curr) {
-        result = g_list_append(result, curr->data);
+        result = g_list_append(result, strdup(curr->data));
         curr = g_list_next(curr);
     }
 
+    g_list_free(plugin_features);
+
     return result;
 }
 
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 0853a345..c88df237 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -1096,7 +1096,7 @@ stanza_create_caps_query_element(xmpp_ctx_t *ctx)
 
         curr = g_list_next(curr);
     }
-    g_list_free(features);
+    g_list_free_full(features, free);
 
     return query;
 }