about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-01-12 12:09:10 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-01-12 12:09:10 +0000
commit1a89fbabb4bd2cfe1d6f4850137ecb60f0040b39 (patch)
tree05f94c972f2765903902265796219643cef99ff7 /Src/builtin.c
parentcf2e6a27d56d9a646af42797d745d42ecca99f7f (diff)
downloadzsh-1a89fbabb4bd2cfe1d6f4850137ecb60f0040b39.tar.gz
zsh-1a89fbabb4bd2cfe1d6f4850137ecb60f0040b39.tar.xz
zsh-1a89fbabb4bd2cfe1d6f4850137ecb60f0040b39.zip
19361: Memory leaks
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 37e3db7eb..48ad69324 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2255,7 +2255,15 @@ bin_typeset(char *name, char **argv, Options ops, int func)
 	    return 1;
 	}
 
+	/*
+	 * pm->ename is only deleted when the struct is, so
+	 * we need to free it here if it already exists.
+	 */
+	if (pm->ename)
+	    zsfree(pm->ename);
 	pm->ename = ztrdup(asg->name);
+	if (apm->ename)
+	    zsfree(apm->ename);
 	apm->ename = ztrdup(asg0.name);
 	if (oldval)
 	    setsparam(asg0.name, oldval);