summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);