mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
fanalyzer: workarounds and fixes
GCC -fanalyzer did find a real issue (unchecked malloc return) but it mainly reported things that weren't true due to what was happening outside of the particular compilation unit that it could see.
This commit is contained in:
parent
e038332424
commit
ee9ab7c1fc
3 changed files with 10 additions and 3 deletions
|
@ -1036,6 +1036,8 @@ lws_mux_mark_immortal(struct lws *wsi)
|
|||
}
|
||||
|
||||
nwsi = lws_get_network_wsi(wsi);
|
||||
if (!nwsi)
|
||||
return;
|
||||
|
||||
lwsl_debug("%s: %p %p %d\n", __func__, wsi, nwsi,
|
||||
nwsi->immortal_substream_count);
|
||||
|
@ -1051,6 +1053,9 @@ lws_mux_mark_immortal(struct lws *wsi)
|
|||
int
|
||||
lws_http_mark_sse(struct lws *wsi)
|
||||
{
|
||||
if (!wsi)
|
||||
return 0;
|
||||
|
||||
lws_http_headers_detach(wsi);
|
||||
lws_mux_mark_immortal(wsi);
|
||||
|
||||
|
|
|
@ -1414,9 +1414,9 @@ set_parsing_complete:
|
|||
|
||||
if (lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE)) {
|
||||
#if defined(LWS_ROLE_WS)
|
||||
if (lws_hdr_total_length(wsi, WSI_TOKEN_VERSION))
|
||||
wsi->rx_frame_type = /* temp for ws version index */
|
||||
atoi(lws_hdr_simple_ptr(wsi, WSI_TOKEN_VERSION));
|
||||
const char *pv = lws_hdr_simple_ptr(wsi, WSI_TOKEN_VERSION);
|
||||
if (pv)
|
||||
wsi->rx_frame_type = atoi(pv);
|
||||
|
||||
lwsl_parser("v%02d hdrs done\n", wsi->rx_frame_type);
|
||||
#endif
|
||||
|
|
|
@ -337,6 +337,8 @@ lws_sspc_create(struct lws_context *context, int tsi, const lws_ss_info_t *ssi,
|
|||
|
||||
h = malloc(sizeof(lws_sspc_handle_t) + ssi->user_alloc +
|
||||
strlen(ssi->streamtype) + 1);
|
||||
if (!h)
|
||||
return 1;
|
||||
memset(h, 0, sizeof(*h));
|
||||
memcpy(&h->ssi, ssi, sizeof(*ssi));
|
||||
ua = (uint8_t *)&h[1];
|
||||
|
|
Loading…
Add table
Reference in a new issue