From 42c0c0df6c7e04729be3ec27a64d5e11f4c5e31d Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 17 Sep 2021 23:09:49 -0500 Subject: [PATCH] Fix error path that was trying to free constant strings. (Fixes "while do" segfaulting.) --- toys/pending/sh.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/toys/pending/sh.c b/toys/pending/sh.c index 64538699..e02fcd8f 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -2917,12 +2917,7 @@ flush: if (s) syntax_err(s); llist_traverse(*ppl, free_pipeline); *ppl = 0; - while (*expect) { - struct double_list *del = dlist_pop(expect); - - if (del->data != (void *)1) free(del->data); - free(del); - } + llist_traverse(*expect, free); *expect = 0; return 0-!!s; -- 2.39.2