1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Call iq_handlers_clear() upon disconnect

Free id_handlers. Fix memory leaks.
This commit is contained in:
Michael Vetter 2019-06-19 23:37:54 +02:00
parent 29e2d16e14
commit 11b8204d14
3 changed files with 10 additions and 0 deletions

View File

@ -251,6 +251,14 @@ iq_handlers_init(void)
rooms_cache = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)xmpp_stanza_release); rooms_cache = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)xmpp_stanza_release);
} }
void
iq_handlers_clear()
{
if (id_handlers) {
g_hash_table_remove_all(id_handlers);
}
}
void void
iq_id_handler_add(const char *const id, ProfIqCallback func, ProfIqFreeCallback free_func, void *userdata) iq_id_handler_add(const char *const id, ProfIqCallback func, ProfIqFreeCallback free_func, void *userdata)
{ {

View File

@ -213,6 +213,7 @@ session_disconnect(void)
accounts_set_last_activity(session_get_account_name()); accounts_set_last_activity(session_get_account_name());
iq_rooms_cache_clear(); iq_rooms_cache_clear();
iq_handlers_clear();
connection_disconnect(); connection_disconnect();

View File

@ -169,6 +169,7 @@ void iq_enable_carbons(void);
void iq_disable_carbons(void); void iq_disable_carbons(void);
void iq_send_software_version(const char *const fulljid); void iq_send_software_version(const char *const fulljid);
void iq_rooms_cache_clear(void); void iq_rooms_cache_clear(void);
void iq_handlers_clear();
void iq_room_list_request(gchar *conferencejid, gchar *filter); void iq_room_list_request(gchar *conferencejid, gchar *filter);
void iq_disco_info_request(gchar *jid); void iq_disco_info_request(gchar *jid);
void iq_disco_items_request(gchar *jid); void iq_disco_items_request(gchar *jid);