about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2008-09-13 08:19:17 +0000
committerClint Adams <clint@users.sourceforge.net>2008-09-13 08:19:17 +0000
commit6b68cc95c7448201d11b87004715fd8e8cd6543e (patch)
treeabb7486257791a68691ebc3e9d76a5b2b1e36ccf
parent2b5ecaf476f6c673edf80c94ce4d8aa6bcb3997d (diff)
downloadzsh-6b68cc95c7448201d11b87004715fd8e8cd6543e.tar.gz
zsh-6b68cc95c7448201d11b87004715fd8e8cd6543e.tar.xz
zsh-6b68cc95c7448201d11b87004715fd8e8cd6543e.zip
25656: free val only after it may be passed to strlen().
-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;