zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <clint@zsh.org>
To: zsh-workers@sunsite.dk
Subject: PATCH: memory leak in parse_cadef
Date: Sun, 14 Sep 2008 07:29:41 +0000	[thread overview]
Message-ID: <20080914072941.GA21909@scru.org> (raw)

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


                 reply	other threads:[~2008-09-14  7:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080914072941.GA21909@scru.org \
    --to=clint@zsh.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).