aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/sh.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-01-08 16:28:54 -0600
committerRob Landley <rob@landley.net>2020-01-08 16:28:54 -0600
commitdffc7ac3229be1aa0dac0c1e4be68a2b36133e35 (patch)
treeebfb2340c1cfe77b122285121458f5b9a8f83d2c /toys/pending/sh.c
parente3c1b14cf9b685528efa50ca068a9f3fd9f9b05c (diff)
downloadtoybox-dffc7ac3229be1aa0dac0c1e4be68a2b36133e35.tar.gz
Fix commaless brace discard.
Diffstat (limited to 'toys/pending/sh.c')
-rw-r--r--toys/pending/sh.c4
1 files changed, 2 insertions, 2 deletions
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)));