about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/buffer.c4
-rw-r--r--src/xmpp/message.c3
-rw-r--r--src/xmpp/stanza.c2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/ui/buffer.c b/src/ui/buffer.c
index 0848b60f..b4771f1a 100644
--- a/src/ui/buffer.c
+++ b/src/ui/buffer.c
@@ -87,7 +87,7 @@ buffer_push(ProfBuff buffer, const char show_char, GDateTime *time,
     e->show_char = show_char;
     e->flags = flags;
     e->theme_item = theme_item;
-    e->time = time;
+    e->time = g_date_time_ref(time);
     e->from = strdup(from);
     e->message = strdup(message);
     e->receipt = receipt;
@@ -136,4 +136,4 @@ _free_entry(ProfBuffEntry *entry)
         free(entry->receipt);
     }
     free(entry);
-}
\ No newline at end of file
+}
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 0d305496..9aa278c1 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -562,6 +562,7 @@ _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
     GDateTime *timestamp = stanza_get_delay(stanza);
     if (timestamp) {
         sv_ev_room_history(jid->barejid, jid->resourcepart, timestamp, message);
+        g_date_time_unref(timestamp);
     } else {
         sv_ev_room_message(jid->barejid, jid->resourcepart, message);
     }
@@ -665,6 +666,7 @@ _private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid)
     GDateTime *timestamp = stanza_get_delay(stanza);
     if (timestamp) {
         sv_ev_delayed_private_message(fulljid, message, timestamp);
+        g_date_time_unref(timestamp);
     } else {
         sv_ev_incoming_private_message(fulljid, message);
     }
@@ -803,6 +805,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * con
         }
     }
 
+    if (timestamp) g_date_time_unref(timestamp);
     jid_destroy(jid);
     return 1;
 }
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 4999c81b..beb03f45 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -995,6 +995,7 @@ stanza_get_delay(xmpp_stanza_t * const stanza)
             if (stamp && (g_time_val_from_iso8601(stamp, &utc_stamp))) {
                 GDateTime *utc_datetime = g_date_time_new_from_timeval_utc(&utc_stamp);
                 GDateTime *local_datetime = g_date_time_to_local(utc_datetime);
+                g_date_time_unref(utc_datetime);
                 return local_datetime;
             }
         }
@@ -1010,6 +1011,7 @@ stanza_get_delay(xmpp_stanza_t * const stanza)
             if (stamp && (g_time_val_from_iso8601(stamp, &utc_stamp))) {
                 GDateTime *utc_datetime = g_date_time_new_from_timeval_utc(&utc_stamp);
                 GDateTime *local_datetime = g_date_time_to_local(utc_datetime);
+                g_date_time_unref(utc_datetime);
                 return local_datetime;
             }
         }