zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: memory leak in parse_cadef
@ 2008-09-14  7:29 Clint Adams
  0 siblings, 0 replies; only message in thread
From: Clint Adams @ 2008-09-14  7:29 UTC (permalink / raw)
  To: zsh-workers

If you have a (broken) _arguments call like this, memory gets zalloc'd
to the variable xor because of the (-c), then not freed because 2Q is an
invalid argument number.

_arguments \
  '-c[blah]' \
  '(-c)2Q:blah:(one two three)'


Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.107
diff -u -r1.107 computil.c
--- Src/Zle/computil.c	8 Jun 2008 17:53:55 -0000	1.107
+++ Src/Zle/computil.c	14 Sep 2008 07:24:35 -0000
@@ -1549,6 +1549,8 @@
 	    if (*p != ':') {
 		freecadef(all);
 		zwarnnam(nam, "invalid argument: %s", *args);
+		if (xor)
+		    free(xor);
 		return NULL;
 	    }
 	    if (*++p == ':') {


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

only message in thread, other threads:[~2008-09-14  7:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-14  7:29 PATCH: memory leak in parse_cadef Clint Adams

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).