From f8d74d058e546851a1bc568cc611f9a1f1cd7b06 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 8 Nov 2021 10:00:17 +0000 Subject: [PATCH] adopt: coverity: add pointless vh NULL check The wsi is always created on a valid vhost. Add a needless NULL check on it to satisfy coverity. --- lib/core-net/adopt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/core-net/adopt.c b/lib/core-net/adopt.c index 9f0c26caa..7130f5981 100644 --- a/lib/core-net/adopt.c +++ b/lib/core-net/adopt.c @@ -120,7 +120,7 @@ __lws_adopt_descriptor_vhost1(struct lws_vhost *vh, lws_adoption_type type, const char *vh_prot_name, struct lws *parent, void *opaque, const char *fi_wsi_name) { - struct lws_context *context = vh->context; + struct lws_context *context; struct lws_context_per_thread *pt; struct lws *new_wsi; int n; @@ -131,6 +131,11 @@ __lws_adopt_descriptor_vhost1(struct lws_vhost *vh, lws_adoption_type type, * we initialize it, it may become "live" concurrently unexpectedly... */ + if (!vh) + return NULL; + + context = vh->context; + lws_context_assert_lock_held(vh->context); n = -1;