From 944ef24e6776db4df99a7f7bbd15e24f06c399c2 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 19 Aug 2020 06:52:47 +0100 Subject: [PATCH] coverity: 10600: make sure vhosts get off the pending destruction list if on it --- lib/core-net/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/core-net/vhost.c b/lib/core-net/vhost.c index ed41b8770..cc6338f4b 100644 --- a/lib/core-net/vhost.c +++ b/lib/core-net/vhost.c @@ -1146,8 +1146,10 @@ __lws_vhost_destroy2(struct lws_vhost *vh) /* add ourselves to the pending destruction list */ - vh->vhost_next = vh->context->vhost_pending_destruction_list; - vh->context->vhost_pending_destruction_list = vh; + if (vh->context->vhost_pending_destruction_list != vh) { + vh->vhost_next = vh->context->vhost_pending_destruction_list; + vh->context->vhost_pending_destruction_list = vh; + } lwsl_info("%s: %p\n", __func__, vh);