about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2008-09-21 12:54:57 +0000
committerClint Adams <clint@users.sourceforge.net>2008-09-21 12:54:57 +0000
commitef2d2d0f2b7401374bbf47eea5c8bc6542a0bfee (patch)
treebbb54e8e23235ba58cf86f3ed3b2a123f85443e9
parent1870a858eadc45066f0bd928302dbc66ccc4193e (diff)
downloadzsh-ef2d2d0f2b7401374bbf47eea5c8bc6542a0bfee.tar.gz
zsh-ef2d2d0f2b7401374bbf47eea5c8bc6542a0bfee.tar.xz
zsh-ef2d2d0f2b7401374bbf47eea5c8bc6542a0bfee.zip
25701: fix memory leak in loadautofn.
-rw-r--r--ChangeLog2
-rw-r--r--Src/exec.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 874a4e3aa..96fc3a619 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2008-09-21  Clint Adams  <clint@zsh.org>
 
+	* 25701: Src/exec.c: fix memory leak in loadautofn.
+
 	* 25697: Functions/Prompts/prompt_clint_setup: drop git code and
 	switch to vcs_info.
 
diff --git a/Src/exec.c b/Src/exec.c
index 781598cc1..55b058c17 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4134,10 +4134,13 @@ loadautofn(Shfunc shf, int fksh, int autol)
 	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 @@ loadautofn(Shfunc shf, int fksh, int autol)
 	shf->filename = fname;
     }
     popheap();
+    zsfree(fname);
 
     return shf;
 }