Reorder finalization to avoid potential crash; ref #4618

`mrb_gc_destroy` may call other mruby API functions from the finalizers.
So call that function first.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-08-11 22:10:51 +09:00
parent 70b53f91c2
commit 0376383354
+3 -3
View File
@@ -221,10 +221,10 @@ mrb_close(mrb_state *mrb)
}
/* free */
mrb_gc_free_gv(mrb);
mrb_free_context(mrb, mrb->root_c);
mrb_free_symtbl(mrb);
mrb_gc_destroy(mrb, &mrb->gc);
mrb_free_context(mrb, mrb->root_c);
mrb_gc_free_gv(mrb);
mrb_free_symtbl(mrb);
mrb_free(mrb, mrb);
}