summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pool.c3
-rw-r--r--src/state.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/pool.c b/src/pool.c
index 4d8c42dd1..ffddd2552 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -166,6 +166,9 @@ mrb_pool_realloc(mrb_pool *pool, void *p, size_t oldlen, size_t newlen)
page = page->next;
}
np = mrb_pool_alloc(pool, newlen);
+ if (np == NULL) {
+ return NULL;
+ }
memcpy(np, p, oldlen);
return np;
}
diff --git a/src/state.c b/src/state.c
index 9c16524f2..8d6993b6f 100644
--- a/src/state.c
+++ b/src/state.c
@@ -110,6 +110,10 @@ mrb_open_allocf(mrb_allocf f, void *ud)
{
mrb_state *mrb = mrb_open_core(f, ud);
+ if (mrb == NULL) {
+ return NULL;
+ }
+
#ifndef DISABLE_GEMS
mrb_init_mrbgems(mrb);
mrb_gc_arena_restore(mrb, 0);