Skip to content
Snippets Groups Projects
Commit 60d656fb authored by Andy Green's avatar Andy Green
Browse files

check oom on lws_malloc


Signed-off-by: default avatarAndy Green <andy@warmcat.com>
parent 5cd45762
Branches
Tags
No related merge requests found
......@@ -151,6 +151,10 @@ lws_uv_initloop(struct lws_context *context, uv_loop_t *loop, uv_signal_cb cb,
if (!loop) {
loop = lws_malloc(sizeof(*loop));
if (!loop) {
lwsl_err("OOM\n");
return -1;
}
uv_loop_init(loop);
pt->ev_loop_foreign = 0;
} else
......
......@@ -349,6 +349,8 @@ int lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len)
/* a new rxflow, buffer it and warn caller */
lwsl_info("new rxflow input buffer len %d\n", len - n);
wsi->rxflow_buffer = lws_malloc(len - n);
if (!wsi->rxflow_buffer)
return -1;
wsi->rxflow_len = len - n;
wsi->rxflow_pos = 0;
memcpy(wsi->rxflow_buffer, buf + n, len - n);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment