diff options
| author | Tatsuhiko Kubo <[email protected]> | 2014-08-20 05:15:21 +0900 |
|---|---|---|
| committer | Tatsuhiko Kubo <[email protected]> | 2014-08-20 05:15:21 +0900 |
| commit | 53a7549e1c0dd9a189ac40804b2f5f3e600c9e76 (patch) | |
| tree | acb3a9ebac52e502fc3938a6d441024aaa5b7420 /src/state.c | |
| parent | d49f8517a6d2350eb1ed2642749f3994a9a2d056 (diff) | |
| download | mruby-53a7549e1c0dd9a189ac40804b2f5f3e600c9e76.tar.gz mruby-53a7549e1c0dd9a189ac40804b2f5f3e600c9e76.zip | |
Fix error handling for mrb_open_allocf().
When DISABLE_GEMS is not defined and
a return value of mrb_open_core() is NULL,
mrb_open_allocf() may cause SEGV.
Diffstat (limited to 'src/state.c')
| -rw-r--r-- | src/state.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); |
