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

dovecot at dovecot.org dovecot at dovecot.org
Sun Aug 2 20:53:37 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/19d851d93f92
changeset: 9275:19d851d93f92
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Aug 02 13:53:32 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 693fa1d6160a -r 19d851d93f92 src/lib/env-util.c
--- a/src/lib/env-util.c	Sun Aug 02 13:50:46 2009 -0400
+++ b/src/lib/env-util.c	Sun Aug 02 13:53:32 2009 -0400
@@ -99,3 +99,9 @@ void env_backup_free(struct env_backup *
 	*_env = NULL;
 	pool_unref(&env->pool);
 }
+
+void env_deinit(void)
+{
+	if (env_pool != NULL)
+		pool_unref(&env_pool);
+}
diff -r 693fa1d6160a -r 19d851d93f92 src/lib/env-util.h
--- a/src/lib/env-util.h	Sun Aug 02 13:50:46 2009 -0400
+++ b/src/lib/env-util.h	Sun Aug 02 13:53:32 2009 -0400
@@ -16,4 +16,8 @@ void env_backup_restore(struct env_backu
 /* Free the memory used by environment backup. */
 void env_backup_free(struct env_backup **env);
 
+/* Free all memory used by env_put() function. Environment must not be
+   accessed afterwards. */
+void env_deinit(void);
+
 #endif
diff -r 693fa1d6160a -r 19d851d93f92 src/lib/lib.c
--- a/src/lib/lib.c	Sun Aug 02 13:50:46 2009 -0400
+++ b/src/lib/lib.c	Sun Aug 02 13:53:32 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