diff --git a/lib/core/output.c b/lib/core/output.c index 8f6349bc1..af9a53cfd 100644 --- a/lib/core/output.c +++ b/lib/core/output.c @@ -84,7 +84,7 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len) lwsl_debug("%s: draining %d\n", __func__, (int)len); } - if (!len) + if (!len || !buf) return 0; if (!wsi->http2_substream && !lws_socket_is_valid(wsi->desc.sockfd)) diff --git a/lib/roles/h2/ops-h2.c b/lib/roles/h2/ops-h2.c index 636e8f9b9..c92dd4634 100644 --- a/lib/roles/h2/ops-h2.c +++ b/lib/roles/h2/ops-h2.c @@ -362,6 +362,9 @@ rops_write_role_protocol_h2(struct lws *wsi, unsigned char *buf, size_t len, unsigned char flags = 0, base = (*wp) & 0x1f; size_t olen = len; int n; +#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION) + unsigned char mtubuf[1450 + LWS_PRE]; +#endif /* if not in a state to send stuff, then just send nothing */ @@ -386,7 +389,7 @@ rops_write_role_protocol_h2(struct lws *wsi, unsigned char *buf, size_t len, #if defined(LWS_WITH_HTTP_STREAM_COMPRESSION) if (wsi->http.lcs) { - unsigned char mtubuf[1450 + LWS_PRE], *out = mtubuf + LWS_PRE; + unsigned char *out = mtubuf + LWS_PRE; size_t o = sizeof(mtubuf) - LWS_PRE; n = lws_http_compression_transform(wsi, buf, len, wp, &out, &o); diff --git a/lib/roles/http/server/server.c b/lib/roles/http/server/server.c index e1e1bd973..25751964b 100644 --- a/lib/roles/http/server/server.c +++ b/lib/roles/http/server/server.c @@ -587,7 +587,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin, /* but we still need to send cache control... */ - if (m && m->cache_max_age && m->cache_reusable) { + if (m->cache_max_age && m->cache_reusable) { if (!m->cache_revalidate) { cc = cache_control; cclen = sprintf(cache_control, "%s, max-age=%u",