mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user