dovecot-1.1: env_clean(): Don't free environment memory pool to ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 9 19:06:11 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/c2747ab1696e
changeset: 7622:c2747ab1696e
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 09 19:05:29 2008 +0300
description:
env_clean(): Don't free environment memory pool to make sure the environment
won't get corrupted in case the clearing fails.

diffstat:

1 file changed, 5 insertions(+), 2 deletions(-)
src/lib/env-util.c |    7 +++++--

diffs (18 lines):

diff -r b39bf7ec215a -r c2747ab1696e src/lib/env-util.c
--- a/src/lib/env-util.c	Mon Jun 09 06:25:33 2008 +0300
+++ b/src/lib/env-util.c	Mon Jun 09 19:05:29 2008 +0300
@@ -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. */
 }


More information about the dovecot-cvs mailing list