about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2007-10-31 21:03:21 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2007-10-31 21:03:21 +0000
commit4ac2515ed8b0309369bd4eb3188e862080c1f564 (patch)
tree872b83f66aefba709773bca50af63b99285b3c78
parent4b367d3d433854831c9f66ac3b9fa32187c92c5a (diff)
downloadzsh-4ac2515ed8b0309369bd4eb3188e862080c1f564.tar.gz
zsh-4ac2515ed8b0309369bd4eb3188e862080c1f564.tar.xz
zsh-4ac2515ed8b0309369bd4eb3188e862080c1f564.zip
24045: fix memory leak where old value of an environment variable isn't freed
-rw-r--r--ChangeLog5
-rw-r--r--Src/params.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3556df483..559f321a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-31  Oliver Kiddle  <opk@zsh.org>
+
+	* 24045: Src/params.c: fix memory leak where old value of an
+	environment variable isn't freed
+
 2007-10-31  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 24043: Functions/Prompts/promptinit: emulate -L resets prompt
diff --git a/Src/params.c b/Src/params.c
index fb79268da..993eaa097 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3998,6 +3998,8 @@ addenv(Param pm, char *value)
       * the other branch?  If so, we don't actually need to
       * store pm->env at all, just a flag that the value was set.
       */
+     if (pm->env)
+         zsfree(pm->env);
      pm->env = newenv;
 #else
     /*