From 963ab841b42fdb1d80594b609a589a25b4034aa7 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 21 Oct 2019 09:50:13 +0200 Subject: [PATCH] Set prof_ident to NULL after free This caused the bug mentioned in the PR comment: ``` It seems with the changes done here we get a crash in: src/xmpp/message.c message_handlers_init() when looking up handlers: ProfMessageHandler *handler = g_hash_table_lookup(pubsub_event_handlers, curr->data);. Steps to reproduce: open Profanity and connect /autoping set 10 /autoping timeout 10 stop WiFi/connection wait for Lost connection restart wifi /connect ``` --- src/xmpp/connection.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 63cd8211..e121d9a6 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -247,6 +247,7 @@ connection_disconnect(void) } free(prof_identifier); + prof_identifier = NULL; } void @@ -681,7 +682,7 @@ static void _compute_identifier(const char *barejid) assert(b64 != NULL); g_free(hmac); - //in case of reconnect + //in case of reconnect (lost connection) free(prof_identifier); prof_identifier = b64;