diff options
author | James Booth <boothj5@gmail.com> | 2016-05-02 00:40:16 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-05-02 00:40:16 +0100 |
commit | 31ab43ea2d4e9aba5b1629d17360ebc459f3f239 (patch) | |
tree | fc09e1ae76498445b41e24640c6009257330279f /src/xmpp | |
parent | 2bacd43a16d62911b6d475287f7c6df87f459fb7 (diff) | |
download | profani-tty-31ab43ea2d4e9aba5b1629d17360ebc459f3f239.tar.gz |
Free stanza text and DiscoInfo features
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/connection.c | 4 | ||||
-rw-r--r-- | src/xmpp/iq.c | 4 | ||||
-rw-r--r-- | src/xmpp/message.c | 2 | ||||
-rw-r--r-- | src/xmpp/presence.c | 2 |
4 files changed, 9 insertions, 3 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 7db3b2ed..34cf939d 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -121,7 +121,7 @@ _info_destroy(DiscoInfo *info) if (info) { free(info->item); if (info->features) { - g_hash_table_remove_all(info->features); + g_hash_table_destroy(info->features); } free(info); } @@ -699,7 +699,7 @@ _connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, con // items discovery DiscoInfo *info = malloc(sizeof(struct disco_info_t)); info->item = strdup(jabber_conn.domain); - info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL); + info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); disco_items = g_slist_append(disco_items, info); iq_disco_info_request_onconnect(info->item); iq_disco_items_request_onconnect(jabber_conn.domain); diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index f3f221e9..fcdaa0a8 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -125,6 +125,7 @@ _iq_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const us size_t text_size; xmpp_stanza_to_text(stanza, &text, &text_size); gboolean cont = plugins_on_iq_stanza_receive(text); + xmpp_free(connection_get_ctx(), text); if (!cont) { return 1; } @@ -2049,7 +2050,7 @@ _disco_items_result_handler(xmpp_stanza_t *const stanza) DiscoItem *item = res_items->data; DiscoInfo *info = malloc(sizeof(struct disco_info_t)); info->item = strdup(item->jid); - info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL); + info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); jabber_set_disco_items(g_slist_append(jabber_get_disco_items(), info)); iq_disco_info_request_onconnect(info->item); res_items = g_slist_next(res_items); @@ -2075,4 +2076,5 @@ send_iq_stanza(xmpp_stanza_t *const stanza) } else { xmpp_send_raw_string(conn, "%s", text); } + xmpp_free(connection_get_ctx(), text); } diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 9516217d..93e78893 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -81,6 +81,7 @@ _message_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *con size_t text_size; xmpp_stanza_to_text(stanza, &text, &text_size); gboolean cont = plugins_on_message_stanza_receive(text); + xmpp_free(connection_get_ctx(), text); if (!cont) { return 1; } @@ -876,4 +877,5 @@ _send_message_stanza(xmpp_stanza_t *const stanza) } else { xmpp_send_raw_string(conn, "%s", text); } + xmpp_free(connection_get_ctx(), text); } diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index c147970c..0a9b3ce0 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -93,6 +93,7 @@ _presence_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *co size_t text_size; xmpp_stanza_to_text(stanza, &text, &text_size); gboolean cont = plugins_on_presence_stanza_receive(text); + xmpp_free(connection_get_ctx(), text); if (!cont) { return 1; } @@ -845,4 +846,5 @@ _send_presence_stanza(xmpp_stanza_t *const stanza) } else { xmpp_send_raw_string(conn, "%s", text); } + xmpp_free(connection_get_ctx(), text); } |