From 18a1daede82a3d79d7911ef9a4dedfb755b629a3 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 26 May 2018 01:15:23 +0200 Subject: [PATCH] websocket: check return value of list_destroy() calls --- lib/nodes/websocket.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/nodes/websocket.c b/lib/nodes/websocket.c index 429e100b0..ea2a5f2c0 100644 --- a/lib/nodes/websocket.c +++ b/lib/nodes/websocket.c @@ -352,6 +352,8 @@ int websocket_init(struct super_node *sn) int websocket_deinit() { + int ret; + for (size_t i = 0; i < list_length(&connections); i++) { struct websocket_connection *c = (struct websocket_connection *) list_at(&connections, i); @@ -366,7 +368,9 @@ int websocket_deinit() sleep(1); } - list_destroy(&connections, (dtor_cb_t) websocket_destination_destroy, true); + ret = list_destroy(&connections, (dtor_cb_t) websocket_destination_destroy, true); + if (ret) + return ret; return 0; } @@ -470,8 +474,11 @@ int websocket_stop(struct node *n) int websocket_destroy(struct node *n) { struct websocket *w = (struct websocket *) n->_vd; + int ret; - list_destroy(&w->destinations, (dtor_cb_t) websocket_destination_destroy, true); + ret = list_destroy(&w->destinations, (dtor_cb_t) websocket_destination_destroy, true); + if (ret) + return ret; return 0; }