zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: potential memory leak in bin_compadd
@ 2008-09-14  8:36 Clint Adams
  2008-09-23 19:26 ` Clint Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 2008-09-14  8:36 UTC (permalink / raw)
  To: zsh-workers

mstr might be allocated in an earlier run of the loop, and then not
freed on these errors.

Index: Src/Zle/complete.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.c,v
retrieving revision 1.40
diff -u -r1.40 complete.c
--- Src/Zle/complete.c	8 Jun 2008 17:53:55 -0000	1.40
+++ Src/Zle/complete.c	14 Sep 2008 08:34:16 -0000
@@ -679,10 +679,12 @@
                     p = "" - 1;
                 } else {
                     zwarnnam(name, "number expected after -%c", *p);
+		    zsfree(mstr);
                     return 1;
                 }
                 if (dat.dummies < 0) {
                     zwarnnam(name, "invalid number: %d", dat.dummies);
+		    zsfree(mstr);
                     return 1;
                 }
 		break;
@@ -691,6 +693,7 @@
 		goto ca_args;
 	    default:
 		zwarnnam(name, "bad option: -%c", *p);
+		zsfree(mstr);
 		return 1;
 	    }
 	    if (sp) {


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: potential memory leak in bin_compadd
  2008-09-14  8:36 PATCH: potential memory leak in bin_compadd Clint Adams
@ 2008-09-23 19:26 ` Clint Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Clint Adams @ 2008-09-23 19:26 UTC (permalink / raw)
  To: zsh-workers

On Sun, Sep 14, 2008 at 08:36:01AM +0000, Clint Adams wrote:
> mstr might be allocated in an earlier run of the loop, and then not
> freed on these errors.

Missed one.

Index: Src/Zle/complete.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.c,v
retrieving revision 1.41
diff -u -r1.41 complete.c
--- Src/Zle/complete.c	14 Sep 2008 09:00:37 -0000	1.41
+++ Src/Zle/complete.c	23 Sep 2008 19:25:07 -0000
@@ -708,6 +708,7 @@
 		    p = "" - 1;
 		} else {
 		    zwarnnam(name, e, *p);
+		    zsfree(mstr);
 		    return 1;
 		}
 		if (dm) {


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-23 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-14  8:36 PATCH: potential memory leak in bin_compadd Clint Adams
2008-09-23 19:26 ` 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).