From 7b22c813c8daf7f080a098705394b4f70e0b818b Mon Sep 17 00:00:00 2001 From: James Booth Date: Wed, 17 Aug 2016 23:32:43 +0100 Subject: Copy feature strings on caps_get_features --- src/xmpp/capabilities.c | 6 ++++-- src/xmpp/stanza.c | 2 +- 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; } -- cgit 1.4.1-2-gfad0