about summary refs log tree commit diff
path: root/Src
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 /Src
parent1870a858eadc45066f0bd928302dbc66ccc4193e (diff)
downloadzsh-ef2d2d0f2b7401374bbf47eea5c8bc6542a0bfee.tar.gz
zsh-ef2d2d0f2b7401374bbf47eea5c8bc6542a0bfee.tar.xz
zsh-ef2d2d0f2b7401374bbf47eea5c8bc6542a0bfee.zip
25701: fix memory leak in loadautofn.
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c6
1 files changed, 5 insertions, 1 deletions
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;
 }