From dde7d32db7ac1f784e84e79d33442558a7c21d41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Thu, 12 May 2016 14:42:35 +0200 Subject: [PATCH] fix the linked list leak MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I0a26ed98b400df3dfde07d86c058120c8d140329 Signed-off-by: José Bollo --- src/afb-ws-json1.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c index 05c19e7d..67ce2d8e 100644 --- a/src/afb-ws-json1.c +++ b/src/afb-ws-json1.c @@ -343,6 +343,14 @@ static void wsreq_addref(struct afb_wsreq *wsreq) static void wsreq_unref(struct afb_wsreq *wsreq) { if (--wsreq->refcount == 0) { + struct afb_wsreq **prv = &wsreq->ws->requests; + while(*prv != NULL) { + if (*prv == wsreq) { + *prv = wsreq->next; + break; + } + prv = &(*prv)->next; + } afb_context_disconnect(&wsreq->context); free(wsreq->text); free(wsreq); -- 2.16.6