fix leaking in comp.c

This commit is contained in:
dzaima 2023-01-26 19:27:43 +02:00
parent 5f9aeafec6
commit f13e82af62
2 changed files with 7 additions and 4 deletions

View File

@ -117,7 +117,7 @@ NOINLINE void farr_print(FILE* f, B x) { // should accept refc=0 arguments for d
if (!isC32(c) || o2cG(c)<32) goto reg;
}
fprintf(f, "\"");
fprintsB(f, x);
fprintsB(f, taga(a(x))); // allow incorrectly tagged input (e.g. by heapverify)
fprintf(f, "\"");
return;
}

View File

@ -375,10 +375,12 @@ B nc_parseBlock(B tokens, usz i0, u32 end, bool isBlock, B* objs, u32* varCount)
B vars0 = emptyHVec();
#endif
Vars vars = &vars0;
B toFree = emptyHVec();
if (isBlock) {
nc_var(vars, m_c32vec(U"𝕤", 1));
nc_var(vars, m_c32vec(U"𝕩", 1));
nc_var(vars, m_c32vec(U"𝕨", 1));
B t;
t=m_c32vec(U"𝕤", 1); nc_var(vars, t); nc_add(&toFree, t);
t=m_c32vec(U"𝕩", 1); nc_var(vars, t); nc_add(&toFree, t);
t=m_c32vec(U"𝕨", 1); nc_var(vars, t); nc_add(&toFree, t);
}
B r0 = nc_parseStatements(tokens, i0, &i1, end, objs, vars);
#if FAST_NATIVE_COMP
@ -392,6 +394,7 @@ B nc_parseBlock(B tokens, usz i0, u32 end, bool isBlock, B* objs, u32* varCount)
if (i1 != IA(tokens)) thrM("Native compiler: Code present after block end");
B r = IGet(r0, 1);
decG(r0);
decG(toFree);
return r;
}