]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
env_clean(): Don't free environment memory pool to make sure the environment
authorTimo Sirainen <tss@iki.fi>
Mon, 9 Jun 2008 16:05:29 +0000 (19:05 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 9 Jun 2008 16:05:29 +0000 (19:05 +0300)
won't get corrupted in case the clearing fails.

--HG--
branch : HEAD

src/lib/env-util.c

index 708709b216c06fd38930d729ce1e6961ec3aac0e..e1bc683541a9136f38d1b0f00af6d94194ebcee0 100644 (file)
@@ -21,9 +21,12 @@ void env_clean(void)
 {
        extern char **environ;
 
+       /* Try to clear the environment. It should always be non-NULL, but
+          apparently it's not on some ancient OSes (Ultrix), so just keep
+          the check. The clearing also fails on FreeBSD 7.0 (currently). */
        if (environ != NULL)
                *environ = NULL;
 
-       if (pool != NULL)
-               pool_unref(&pool);
+       /* don't clear the env_pool, otherwise the environment would get
+          corrupted if we failed to clear it. */
 }