about summary refs log tree commit diff
diff options
context:
space:
mode:
-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
     /*