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

PATCH: memory leak in parse_cadef



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 == ':') {



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