Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix memory leak in new setenv code
- X-seq: zsh-workers 24045
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: fix memory leak in new setenv code
- Date: Wed, 31 Oct 2007 17:38:55 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I noticed using Solaris libumem and mdb that zsh is leaking memory
every time an environment variable is modified. I traced this down to
some relatively recent change to use setenv(3) and the fact that the
old value was not being freed. I think the patch below is the correct
fix.
Oliver
--- Src/params.c.orig Wed Oct 31 17:30:57 2007
+++ Src/params.c Wed Oct 31 17:28:49 2007
@@ -3998,6 +3998,8 @@
* 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
/*
Messages sorted by:
Reverse Date,
Date,
Thread,
Author