From e9c5c1979d836ed75c37d48651710b4fd125cfb2 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 25 Feb 2020 15:24:53 +0100 Subject: [PATCH] Fix memleak in _handle_groupchat() We need to unref the timestamp before setting a new one. --- src/xmpp/message.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/xmpp/message.c b/src/xmpp/message.c index a5c6c33f..41ab6a81 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -872,7 +872,12 @@ _handle_groupchat(xmpp_stanza_t *const stanza) message->timestamp = stanza_get_delay_from(stanza, jid->domainpart); } - bool is_muc_history = message->timestamp != NULL; + bool is_muc_history; + if (message->timestamp != NULL) { + is_muc_history = TRUE; + g_date_time_unref(message->timestamp); + message->timestamp = NULL; + } // we want to display the oldest delay message->timestamp = stanza_get_oldest_delay(stanza);