From 1457d9f3386595fd13a61ac487111be41a6ed735 Mon Sep 17 00:00:00 2001 From: rxi Date: Sat, 28 Sep 2019 17:20:01 +0100 Subject: [PATCH] Made `dolist` push `lst` to gc stack with each iteration Required as in instances where a function rebinds itself during its own execution, the body of the previous version of it could become unreachable and get garbage collected while it was still trying to execute --- src/fe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fe.c b/src/fe.c index 4ac1f27..667aab8 100644 --- a/src/fe.c +++ b/src/fe.c @@ -573,6 +573,7 @@ static fe_Object* dolist(fe_Context *ctx, fe_Object *lst, fe_Object *env) { int save = fe_savegc(ctx); while (!isnil(lst)) { fe_restoregc(ctx, save); + fe_pushgc(ctx, lst); fe_pushgc(ctx, env); res = eval(ctx, fe_nextarg(ctx, &lst), env, &env); }