diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index 8f222700..be557761 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -146,7 +146,7 @@ B select_c2(B t, B w, B x) { BS2B wgetU = TI(w).getU; for (; i < wia; i++) { B cw = wgetU(w, i); - if (!isNum(cw)) { harr_pfree(r.b, i); goto base; } + if (!isNum(cw)) { harr_abandon(r); goto base; } usz c = WRAP(o2i64(cw), xia, thrF("โŠ: Indexing out-of-bounds (%RโˆŠ๐•จ, %sโ‰กโ‰ ๐•ฉ)", cw, xia)); r.a[i] = xget(x, c); } diff --git a/src/core/harr.h b/src/core/harr.h index 753a2a89..dfaad060 100644 --- a/src/core/harr.h +++ b/src/core/harr.h @@ -55,6 +55,10 @@ static usz* harr_fa(HArr_p p, ur r) { VTY(p.b, t_harrPartial); gsPop(); return arr_shAllocR(p.b, r); } +static void harr_abandon(HArr_p p) { VTY(p.b, t_harrPartial); + gsPop(); + value_free((Value*)p.c); +} static HArr_p m_harrUv(usz ia) { B r = m_arr(fsizeof(HArr,a,B,ia), t_harr);