From 65b3f82c5f40e26b384d734a3d1206c09bf45ba5 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Mon, 1 Apr 2019 13:42:24 +0200 Subject: [PATCH] Fix devicelist notification handler devicelist handler should be kept after trigger --- src/xmpp/message.c | 3 +-- src/xmpp/omemo.c | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/xmpp/message.c b/src/xmpp/message.c index bc91ef3b..2a6ad234 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -142,7 +142,6 @@ _message_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *con if (handler) { int keep = handler->func(stanza, handler->userdata); if (!keep) { - free(handler); g_hash_table_remove(pubsub_event_handlers, node); } } @@ -176,7 +175,7 @@ message_handlers_init(void) g_hash_table_destroy(pubsub_event_handlers); } - pubsub_event_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL); + pubsub_event_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); } void diff --git a/src/xmpp/omemo.c b/src/xmpp/omemo.c index c8ac7ed5..8c8d56e0 100644 --- a/src/xmpp/omemo.c +++ b/src/xmpp/omemo.c @@ -337,19 +337,19 @@ _omemo_receive_devicelist(xmpp_stanza_t *const stanza, void *const userdata) } if (!root) { - return 0; + return 1; } xmpp_stanza_t *items = xmpp_stanza_get_child_by_name(root, "items"); if (!items) { - return 0; + return 1; } xmpp_stanza_t *item = xmpp_stanza_get_child_by_name(items, "item"); if (item) { xmpp_stanza_t *list = xmpp_stanza_get_child_by_ns(item, STANZA_NS_OMEMO); if (!list) { - return 0; + return 1; } xmpp_stanza_t *device; @@ -360,7 +360,7 @@ _omemo_receive_devicelist(xmpp_stanza_t *const stanza, void *const userdata) } omemo_set_device_list(from, device_list); - return 0; + return 1; } static int