From a54def3e923b78b5581e46c4e6311db33a73ee62 Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Fri, 23 Oct 2015 00:40:13 +0300 Subject: [PATCH] examples/bot: fixed memory leak --- examples/bot.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/bot.c b/examples/bot.c index 73b02bb..80a93f3 100644 --- a/examples/bot.c +++ b/examples/bot.c @@ -87,11 +87,14 @@ int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void replytext = malloc(strlen(" to you too!") + strlen(intext) + 1); strcpy(replytext, intext); strcat(replytext, " to you too!"); + xmpp_free(ctx, intext); text = xmpp_stanza_new(ctx); xmpp_stanza_set_text(text, replytext); xmpp_stanza_add_child(body, text); xmpp_stanza_add_child(reply, body); + xmpp_stanza_release(body); + xmpp_stanza_release(text); xmpp_send(conn, reply); xmpp_stanza_release(reply);