From a3fe2f184d6aebadd277ba5391ced78dfe0ece14 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 7 May 2018 18:56:26 +0200 Subject: [PATCH] websocket: return allocated samples before destroying client connection --- lib/nodes/websocket.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/nodes/websocket.c b/lib/nodes/websocket.c index 172e43030..4a760e5a1 100644 --- a/lib/nodes/websocket.c +++ b/lib/nodes/websocket.c @@ -199,6 +199,13 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi if (c->_name) free(c->_name); + /* Return all samples to pool */ + int avail; + struct sample *smp; + while ((avail = queue_pull(&c->queue, (void **) &smp))) + sample_put(smp); + + /* Destroy queue */ ret = queue_destroy(&c->queue); if (ret) return ret;