summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-01-09 14:10:02 +0100
committerMikael Magnusson <mikachu@gmail.com>2015-01-10 08:48:18 +0100
commit573679c34b9bc52341f6813f19a70c6727e6ac78 (patch)
treea3d7a35f9d5f22d413029e866b6bbe880a9bef7b
parent7dcaa2ff6028a2ceb1ca73c7804babef731779aa (diff)
downloadzsh-573679c34b9bc52341f6813f19a70c6727e6ac78.tar.gz
zsh-573679c34b9bc52341f6813f19a70c6727e6ac78.tar.xz
zsh-573679c34b9bc52341f6813f19a70c6727e6ac78.zip
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).
-rw-r--r--Src/loop.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Src/loop.c b/Src/loop.c
index 7b3bdd2c8..d025fbb9f 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);