zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: select: Fix leak of 256 bytes on every loop when zle is not used
@ 2015-01-09 13:10 Mikael Magnusson
  0 siblings, 0 replies; only message in thread
From: Mikael Magnusson @ 2015-01-09 13:10 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-09 13:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 13:10 PATCH: select: Fix leak of 256 bytes on every loop when zle is not used Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).