Fix for environment leak
authorSven Verdoolaege <skimo@breughel.ufsia.ac.be>
Tue, 15 Apr 1997 08:32:46 +0000 (10:32 +0200)
committerChip Salzenberg <chip@atlantic.net>
Mon, 14 Apr 1997 12:00:00 +0000 (00:00 +1200)
This patch fixes a leak in my_setenv.
I know this is close to the release of 5.004, but this is
relatively important for long running FastCGI programs.

I can prove the correctness :-)

p5p-msgid: 19970415103246.NN46698@breughel.ufsia.ac.be

util.c

diff --git a/util.c b/util.c
index 6e5ef47..3b496ed 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1350,6 +1350,7 @@ char *nam, *val;
        environ = tmpenv;               /* tell exec where it is now */
     }
     if (!val) {
+       if (environ[i]) Safefree(environ[i]);
        while (environ[i]) {
            environ[i] = environ[i+1];
            i++;