Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: select: Fix leak of 256 bytes on every loop when zle is not used



Reproduce by
yes | head -n 1000000 | zsh -c 'select foo in a b c; do done; sleep 30; echo'

Found by Coverity (Issue 439082).
---
 Src/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Src/loop.c b/Src/loop.c
index 7b3bdd2..d025fbb 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -269,7 +269,7 @@ execselect(Estate state, UNUSED(int do_exec))
 		    zputs(str, stderr);
 		    free(str);
 		    fflush(stderr);
-		    str = fgets(zalloc(256), 256, inp);
+		    str = fgets(zhalloc(256), 256, inp);
 	    	}
 	    } else
 		str = (char *)getlinknode(bufstack);
-- 
2.2.0.GIT



Messages sorted by: Reverse Date, Date, Thread, Author