about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-04-13 10:04:37 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-04-13 10:04:37 +0200
commit18c64c05806646033199a11ee9bb38aebda723d5 (patch)
tree097652e693ae99effdf64059589ec073ff807be5
parent51518497e5bb11aa795ef2267512786eb16467df (diff)
downloadprofani-tty-18c64c05806646033199a11ee9bb38aebda723d5.tar.gz
Free timestamp correctly
g_date_time_add_days() actually creates a new one.
-rw-r--r--src/xmpp/iq.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 8152ec01..2bcf9bba 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -2512,8 +2512,9 @@ iq_mam_request(ProfChatWin *win)
     xmpp_ctx_t * const ctx = connection_get_ctx();
     char *id = connection_create_stanza_id();
 
-    GDateTime *timestamp = g_date_time_new_now_local();
-    timestamp = g_date_time_add_days(timestamp, -1);
+    GDateTime *now = g_date_time_new_now_local();
+    GDateTime *timestamp = g_date_time_add_days(now, -1);
+    g_date_time_unref(now);
     gchar *datestr = g_date_time_format(timestamp,"%FT%T%:::z");
     xmpp_stanza_t *iq = stanza_create_mam_iq(ctx, win->barejid, datestr);
     g_free(datestr);