about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-05-08 03:14:22 +0100
committerJames Booth <boothj5@gmail.com>2016-05-08 03:14:22 +0100
commitec51ae689c0e1e6a2fa3be2280a03d21fa252289 (patch)
treeb3c7c0990545b8f1ae857d5b7518b18e8fc75634 /src
parentac3ab39e233f4a0eb4c4b08086d3d17bea860248 (diff)
downloadprofani-tty-ec51ae689c0e1e6a2fa3be2280a03d21fa252289.tar.gz
Free features on disconnect
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/connection.c3
-rw-r--r--src/xmpp/connection.h1
-rw-r--r--src/xmpp/session.c1
3 files changed, 4 insertions, 1 deletions
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();