about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2020-06-05 15:39:04 +0200
committerMikael Magnusson <mikachu@gmail.com>2020-06-05 15:42:31 +0200
commited23768f774eed04f1a9dd25b6e7fb76a2418dc4 (patch)
tree5da4f902741240748aee1b55cf892c3b699c9084 /Src
parenta44f44d6e661925531ef637e79aeb64ee13c93cf (diff)
downloadzsh-ed23768f774eed04f1a9dd25b6e7fb76a2418dc4.tar.gz
zsh-ed23768f774eed04f1a9dd25b6e7fb76a2418dc4.tar.xz
zsh-ed23768f774eed04f1a9dd25b6e7fb76a2418dc4.zip
typeset: Fix leaving corrupted entries in paramtab
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index d5a874a95..770930579 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2480,12 +2480,16 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 	    return NULL;
 	}
 	if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z)) {
-	    if (typeset_setwidth(cname, pm, ops, on, 0))
+	    if (typeset_setwidth(cname, pm, ops, on, 0)) {
+		unsetparam_pm(pm, 0, 1);
 		return NULL;
+	    }
 	}
 	if (on & (PM_INTEGER | PM_EFLOAT | PM_FFLOAT)) {
-	    if (typeset_setbase(cname, pm, ops, on, 0))
+	    if (typeset_setbase(cname, pm, ops, on, 0)) {
+		unsetparam_pm(pm, 0, 1);
 		return NULL;
+	    }
 	}
     } else {
 	if (idigit(*pname))
@@ -2503,8 +2507,10 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 	 */
 	struct tieddata *tdp = (struct tieddata *)
 	    zalloc(sizeof(struct tieddata));
-	if (!tdp)
+	if (!tdp) {
+	    unsetparam_pm(pm, 0, 1);
 	    return NULL;
+	}
 	tdp->joinchar = joinchar;
 	tdp->arrptr = &altpm->u.arr;