zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: loadautofn memory leak
@ 2008-09-21 12:45 Clint Adams
  2008-09-22 17:30 ` Clint Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 2008-09-21 12:45 UTC (permalink / raw)
  To: zsh-workers

getfpfunc allocates memory for fname, which was not freed one these
codepaths.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.152
diff -u -r1.152 exec.c
--- Src/exec.c	16 Sep 2008 15:06:57 -0000	1.152
+++ Src/exec.c	21 Sep 2008 12:38:45 -0000
@@ -4134,10 +4134,13 @@
 	zwarn("%s: function definition file not found", shf->node.nam);
 	locallevel++;
 	popheap();
+	zsfree(fname);
 	return NULL;
     }
-    if (!prog)
+    if (!prog) {
+	zsfree(fname);
 	return NULL;
+    }
     if (ksh == 2 || (ksh == 1 && isset(KSHAUTOLOAD))) {
 	if (autol) {
 	    prog->flags |= EF_RUN;
@@ -4174,6 +4177,7 @@
 	shf->filename = fname;
     }
     popheap();
+    zsfree(fname);
 
     return shf;
 }


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

* Re: PATCH: loadautofn memory leak
  2008-09-21 12:45 PATCH: loadautofn memory leak Clint Adams
@ 2008-09-22 17:30 ` Clint Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Clint Adams @ 2008-09-22 17:30 UTC (permalink / raw)
  To: zsh-workers

On Sun, Sep 21, 2008 at 12:45:30PM +0000, Clint Adams wrote:
> getfpfunc allocates memory for fname, which was not freed one these
> codepaths.

That wasn't even English, and this was causing segfaults.  Possibly the
entirety of 25701 was a huge mistake.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.154
diff -u -r1.154 exec.c
--- Src/exec.c	21 Sep 2008 13:41:03 -0000	1.154
+++ Src/exec.c	22 Sep 2008 17:29:16 -0000
@@ -4134,7 +4134,6 @@
 	zwarn("%s: function definition file not found", shf->node.nam);
 	locallevel++;
 	popheap();
-	zsfree(fname);
 	return NULL;
     }
     if (!prog) {


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

end of thread, other threads:[~2008-09-22 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-21 12:45 PATCH: loadautofn memory leak Clint Adams
2008-09-22 17:30 ` 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).