From ec51ae689c0e1e6a2fa3be2280a03d21fa252289 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 8 May 2016 03:14:22 +0100 Subject: Free features on disconnect --- src/xmpp/connection.c | 3 ++- src/xmpp/connection.h | 1 + src/xmpp/session.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 0d456102..abc9f6a4 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -85,7 +85,7 @@ void connection_init(void) conn.xmpp_conn = NULL; conn.xmpp_ctx = NULL; conn.domain = NULL; - conn.features_by_jid = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)g_hash_table_destroy); + conn.features_by_jid = NULL; conn.available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)resource_destroy); } @@ -434,6 +434,7 @@ _connection_handler(xmpp_conn_t *const xmpp_conn, const xmpp_conn_event_t status conn.domain = strdup(my_jid->domainpart); jid_destroy(my_jid); + conn.features_by_jid = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)g_hash_table_destroy); g_hash_table_insert(conn.features_by_jid, strdup(conn.domain), g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL)); session_login_success(connection_is_secured()); diff --git a/src/xmpp/connection.h b/src/xmpp/connection.h index 75022975..f4d0e387 100644 --- a/src/xmpp/connection.h +++ b/src/xmpp/connection.h @@ -59,6 +59,7 @@ xmpp_ctx_t* connection_get_ctx(void); char *connection_get_domain(void); char* connection_jid_for_feature(const char *const feature); GHashTable* connection_get_features(const char *const jid); +void connection_disco_items_free(void); void connection_add_available_resource(Resource *resource); void connection_remove_available_resource(const char *const resource); diff --git a/src/xmpp/session.c b/src/xmpp/session.c index a1a223ff..06b3cb57 100644 --- a/src/xmpp/session.c +++ b/src/xmpp/session.c @@ -388,6 +388,7 @@ _session_free_saved_details(void) static void _session_free_session_data(void) { + connection_disco_items_free(); connection_remove_all_available_resources(); chat_sessions_clear(); presence_clear_sub_requests(); -- cgit 1.4.1-2-gfad0