projects
/
platform
/
upstream
/
libwebsockets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5cd4576
)
check oom on lws_malloc
author
Andy Green
<andy@warmcat.com>
Thu, 12 May 2016 13:54:29 +0000
(21:54 +0800)
committer
Andy Green
<andy@warmcat.com>
Thu, 12 May 2016 13:54:29 +0000
(21:54 +0800)
Signed-off-by: Andy Green <andy@warmcat.com>
lib/libuv.c
patch
|
blob
|
history
lib/service.c
patch
|
blob
|
history
diff --git
a/lib/libuv.c
b/lib/libuv.c
index
2870316
..
bdbd88d
100644
(file)
--- a/
lib/libuv.c
+++ b/
lib/libuv.c
@@
-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
diff --git
a/lib/service.c
b/lib/service.c
index
ceab37a
..
15ec0f4
100644
(file)
--- a/
lib/service.c
+++ b/
lib/service.c
@@
-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);