mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 15:46:21 +00:00
Fix memleak in stanza_get_oldest_delay
We need to unref the temp datetimes again.
This commit is contained in:
@@ -1286,15 +1286,27 @@ stanza_get_oldest_delay(xmpp_stanza_t *const stanza)
|
|||||||
if (child_name && strcmp(child_name, STANZA_NAME_DELAY) == 0) {
|
if (child_name && strcmp(child_name, STANZA_NAME_DELAY) == 0) {
|
||||||
GDateTime *tmp = _stanza_get_delay_timestamp_xep0203(child);
|
GDateTime *tmp = _stanza_get_delay_timestamp_xep0203(child);
|
||||||
|
|
||||||
if (!oldest || g_date_time_compare(oldest, tmp) == 1)
|
if (oldest == NULL) {
|
||||||
oldest = tmp;
|
oldest = tmp;
|
||||||
|
} else if (g_date_time_compare(oldest, tmp) == 1) {
|
||||||
|
g_date_time_unref(oldest);
|
||||||
|
oldest = tmp;
|
||||||
|
} else {
|
||||||
|
g_date_time_unref(tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child_name && strcmp(child_name, STANZA_NAME_X) == 0) {
|
if (child_name && strcmp(child_name, STANZA_NAME_X) == 0) {
|
||||||
GDateTime *tmp = _stanza_get_delay_timestamp_xep0091(child);
|
GDateTime *tmp = _stanza_get_delay_timestamp_xep0091(child);
|
||||||
|
|
||||||
if (!oldest || g_date_time_compare(oldest, tmp) == 1)
|
if (oldest == NULL) {
|
||||||
oldest = tmp;
|
oldest = tmp;
|
||||||
|
} else if (g_date_time_compare(oldest, tmp) == 1) {
|
||||||
|
g_date_time_unref(oldest);
|
||||||
|
oldest = tmp;
|
||||||
|
} else {
|
||||||
|
g_date_time_unref(tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user