dovecot-1.1: lib_deinit() now frees memory used by env_put().

dovecot at dovecot.org dovecot at dovecot.org
Sun Aug 2 20:54:06 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/2d9de6690d12
changeset: 8338:2d9de6690d12
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Aug 02 13:54:01 2009 -0400
description:
lib_deinit() now frees memory used by env_put().

diffstat:

3 files changed, 13 insertions(+), 1 deletion(-)
src/lib/env-util.c |    6 ++++++
src/lib/env-util.h |    4 ++++
src/lib/lib.c      |    4 +++-

diffs (44 lines):

diff -r c73be201a48b -r 2d9de6690d12 src/lib/env-util.c
--- a/src/lib/env-util.c	Sun Aug 02 13:51:47 2009 -0400
+++ b/src/lib/env-util.c	Sun Aug 02 13:54:01 2009 -0400
@@ -59,3 +59,9 @@ void env_clean(void)
 	/* don't clear the env_pool, otherwise the environment would get
 	   corrupted if we failed to clear it. */
 }
+
+void env_deinit(void)
+{
+	if (pool != NULL)
+		pool_unref(&pool);
+}
diff -r c73be201a48b -r 2d9de6690d12 src/lib/env-util.h
--- a/src/lib/env-util.h	Sun Aug 02 13:51:47 2009 -0400
+++ b/src/lib/env-util.h	Sun Aug 02 13:54:01 2009 -0400
@@ -9,4 +9,8 @@ void env_remove(const char *name);
 /* Clear all environment variables. */
 void env_clean(void);
 
+/* Free all memory used by env_put() function. Environment must not be
+   accessed afterwards. */
+void env_deinit(void);
+
 #endif
diff -r c73be201a48b -r 2d9de6690d12 src/lib/lib.c
--- a/src/lib/lib.c	Sun Aug 02 13:51:47 2009 -0400
+++ b/src/lib/lib.c	Sun Aug 02 13:54:01 2009 -0400
@@ -1,6 +1,7 @@
 /* Copyright (c) 2001-2009 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
+#include "env-util.h"
 #include "hostpid.h"
 
 #include <stdlib.h>
@@ -28,5 +29,6 @@ void lib_deinit(void)
 void lib_deinit(void)
 {
 	data_stack_deinit();
-        failures_deinit();
+	env_deinit();
+	failures_deinit();
 }


More information about the dovecot-cvs mailing list