aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-05-12 14:42:35 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-05-12 14:42:35 +0200
commitdde7d32db7ac1f784e84e79d33442558a7c21d41 (patch)
tree046d1f0c3072d692ba5d3c5a525b7a62bbd694f5
parent7a31f839633c9192c98be1061792b8482f181990 (diff)
fix the linked list leak
Change-Id: I0a26ed98b400df3dfde07d86c058120c8d140329 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-ws-json1.c8
1 files changed, 8 insertions, 0 deletions
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);