From 714b2f9c03bfb430d9faabd9eea272b9a875b4ec Mon Sep 17 00:00:00 2001 From: "Andrey (Stanson) Kozin" Date: Fri, 5 Feb 2016 09:29:27 +0300 Subject: [PATCH] Free send queue on connection release --- src/conn.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/conn.c b/src/conn.c index f621aa7..c2f4177 100644 --- a/src/conn.c +++ b/src/conn.c @@ -187,6 +187,7 @@ xmpp_conn_t *xmpp_conn_clone(xmpp_conn_t * const conn) int xmpp_conn_release(xmpp_conn_t * const conn) { xmpp_ctx_t *ctx; + xmpp_send_queue_t *sq, *tsq; xmpp_connlist_t *item, *prev; xmpp_handlist_t *hlitem, *thli; hash_iterator_t *iter; @@ -268,6 +269,15 @@ int xmpp_conn_release(xmpp_conn_t * const conn) parser_free(conn->parser); + /* free queued */ + sq = conn->send_queue_head; + while (sq) { + tsq = sq; + sq = sq->next; + xmpp_free(ctx, tsq->data); + xmpp_free(ctx, tsq); + } + if (conn->domain) xmpp_free(ctx, conn->domain); if (conn->jid) xmpp_free(ctx, conn->jid); if (conn->bound_jid) xmpp_free(ctx, conn->bound_jid);