1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Coverity fixes

This commit is contained in:
Andy Green 2019-08-17 08:03:47 +01:00
parent 1726b96d41
commit d9dd253021
3 changed files with 11 additions and 3 deletions

View file

@ -269,7 +269,7 @@ _lws_dsh_alloc_tail(lws_dsh_t *dsh, int kind, const void *src1, size_t size1,
*/
s.already_checked = dsh;
if (dsh->list.owner)
if (dsh && dsh->list.owner)
lws_dll2_foreach_safe(dsh->list.owner, &s, try_foreign);
if (!s.best) {
@ -306,7 +306,8 @@ _lws_dsh_alloc_tail(lws_dsh_t *dsh, int kind, const void *src1, size_t size1,
if (replace->next)
replace->next->prev = &s.best->list;
} else
lws_dll2_add_tail(&s.best->list, &dsh->oha[kind].owner);
if (dsh)
lws_dll2_add_tail(&s.best->list, &dsh->oha[kind].owner);
assert(s.dsh->locally_free >= s.best->asize);
s.dsh->locally_free -= s.best->asize;
@ -349,7 +350,8 @@ _lws_dsh_alloc_tail(lws_dsh_t *dsh, int kind, const void *src1, size_t size1,
if (replace->next)
replace->next->prev = &s.best->list;
} else
lws_dll2_add_tail(&obj->list, &dsh->oha[kind].owner);
if (dsh)
lws_dll2_add_tail(&obj->list, &dsh->oha[kind].owner);
assert(s.dsh->locally_free >= asize);
s.dsh->locally_free -= asize;

View file

@ -130,6 +130,8 @@ done_list:
if (info) /* first time */
lwsl_err("VH %s: iface %s port %d DOESN'T EXIST\n",
vhost->name, vhost->iface, vhost->listen_port);
else
return -1;
return (info->options & LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND) == LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND?
-1 : 1;
case LWS_ITOSA_NOT_USABLE:
@ -137,6 +139,8 @@ done_list:
if (info) /* first time */
lwsl_err("VH %s: iface %s port %d NOT USABLE\n",
vhost->name, vhost->iface, vhost->listen_port);
else
return -1;
return (info->options & LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND) == LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND?
-1 : 1;
}

View file

@ -320,10 +320,12 @@ bad_conn_format:
} while (e > 0);
pc = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS);
#if defined(_DEBUG)
if (!pc) {
lwsl_parser("lws_client_int_s_hs: no protocol list\n");
} else
lwsl_parser("lws_client_int_s_hs: protocol list '%s'\n", pc);
#endif
/*
* confirm the protocol the server wants to talk was in the list