about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-25 15:24:53 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-25 15:26:33 +0100
commite9c5c1979d836ed75c37d48651710b4fd125cfb2 (patch)
treea7d6c9ec77c5c66b3cf72cbada307c6fb5921bae /src
parent240aeac4d369df97d0e4ee54bd2924afe75258c8 (diff)
downloadprofani-tty-e9c5c1979d836ed75c37d48651710b4fd125cfb2.tar.gz
Fix memleak in _handle_groupchat()
We need to unref the timestamp before setting a new one.
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/message.c7
1 files changed, 6 insertions, 1 deletions
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);