about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2020-04-05 15:58:28 +0300
committerDmitry Podgorny <pasis.ua@gmail.com>2020-04-05 15:58:28 +0300
commitded48a7e40644050a99d36375b569f581b60bb7f (patch)
treea61b1261b4a03eda24e884eaadcf127f12355eaf
parentdc5ddb8ebe5792a220803c4e0ba9a071177d4537 (diff)
downloadprofani-tty-ded48a7e40644050a99d36375b569f581b60bb7f.tar.gz
Fix memory leak in stanza_attach_correction()
xmpp_stanza_add_child() takes own reference to the child stanza.
Therefore we have to release our reference or the child is lost
and not freed otherwise.
-rw-r--r--src/xmpp/stanza.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 06620c53..8791100b 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -2627,6 +2627,7 @@ stanza_attach_correction(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *con
     xmpp_stanza_set_id(replace_stanza, replace_id);
     xmpp_stanza_set_ns(replace_stanza, STANZA_NS_LAST_MESSAGE_CORRECTION);
     xmpp_stanza_add_child(stanza, replace_stanza);
+    xmpp_stanza_release(replace_stanza);
 
     return stanza;
 }