diff --git a/examples/bot.c b/examples/bot.c
index 03ba9c8..8ace449 100644
--- a/examples/bot.c
+++ b/examples/bot.c
@@ -90,6 +90,11 @@ int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
body = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(body, "body");
+
+ if (strcmp(intext, "end") == 0) {
+ xmpp_stop(ctx);
+ return 1;
+ }
replytext = malloc(strlen(" to you too!") + strlen(intext) + 1);
strcpy(replytext, intext);
.. I tested the bot, and thus libstrophe, for memory leaks with Valgrind. Valgrind reports lots of leaks. The patches submitted in issues #27, #26, #18 didn't help much.
After adding this patch:
.. I tested the bot, and thus libstrophe, for memory leaks with Valgrind. Valgrind reports lots of leaks. The patches submitted in issues #27, #26, #18 didn't help much.
Here's the Valgrind log of the leaks: https://gist.github.com/3317999