diff options
author | James Booth <boothj5@gmail.com> | 2015-06-30 16:11:39 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-06-30 16:21:21 +0100 |
commit | d5f79c7b358507288dfc6d32b59d11164c9c377a (patch) | |
tree | 0d516475858c4f1e59761327d383831290247ff0 /src/xmpp | |
parent | dd206ef637e8f29d5b78f2b72ff27badaec1b14e (diff) | |
download | profani-tty-d5f79c7b358507288dfc6d32b59d11164c9c377a.tar.gz |
Use reference counts for GDateTimes #516
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/message.c | 3 | ||||
-rw-r--r-- | src/xmpp/stanza.c | 2 |
2 files changed, 5 insertions, 0 deletions
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; } } |