about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/params.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bf27348fd..84ed5c287 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-09-13  Clint Adams  <clint@zsh.org>
 
+	* 25656: Src/params.c: free val only after it may be passed to
+	strlen().
+
 	* 25655: Completion/Unix/Command/_rsync: remove completion for
 	--remove-sent-files option.
 
diff --git a/Src/params.c b/Src/params.c
index 39bc8515a..58927f1c0 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2235,10 +2235,10 @@ setstrvalue(Value v, char *val)
     case PM_INTEGER:
 	if (val) {
 	    v->pm->gsu.i->setfn(v->pm, mathevali(val));
-	    zsfree(val);
 	    if ((v->pm->node.flags & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z)) &&
 		!v->pm->width)
 		v->pm->width = strlen(val);
+	    zsfree(val);
 	}
 	if (!v->pm->base && lastbase != -1)
 	    v->pm->base = lastbase;