From dffc7ac3229be1aa0dac0c1e4be68a2b36133e35 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 8 Jan 2020 16:28:54 -0600 Subject: Fix commaless brace discard. --- toys/pending/sh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys/pending') diff --git a/toys/pending/sh.c b/toys/pending/sh.c index 01ba9be1..939048ae 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -367,9 +367,9 @@ int debug; bb->active = bb->commas[bb->cnt+1] = i; for (bnext = bb; bb && bb->active; bb = (bb==blist)?0:bb->prev); dprintf(2, "}[%d]%p@%d\n", bnext->cnt, bb, i); - // discard commaless brace + // discard commaless brace (from start of list or middle) if (!old[i] || !bnext->cnt) - free((blist == bnext) ? dlist_pop(&blist) : bnext); + free(dlist_pop((blist == bnext) ? &blist : &bnext)); } else if (old[i] == '{') { dlist_add_nomalloc((void *)&blist, (void *)(bb = xzalloc(sizeof(struct brace)+34*4))); -- cgit v1.2.3