Need to free contexts when freeing fibers.
Memory leak fixed; ref
@@ -780,10 +780,11 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
{
struct mrb_context *c = ((struct RFiber*)obj)->cxt;
- if (!end && c && c != mrb->root_c) {
+ if (c && c != mrb->root_c) {
mrb_callinfo *ci = c->ci;
mrb_callinfo *ce = c->cibase;
+ if (!end) {
while (ce <= ci) {
struct REnv *e = ci->env;
if (e && !is_dead(&mrb->gc, e) &&
@@ -792,6 +793,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
}
ci--;
}
+ }
mrb_free_context(mrb, c);
}
}
