changeset 9275:19d851d93f92 HEAD

lib_deinit() now frees memory used by env_put().
author Timo Sirainen <tss@iki.fi>
date Sun, 02 Aug 2009 13:53:32 -0400
parents 693fa1d6160a
children 13fa572535f0
files src/lib/env-util.c src/lib/env-util.h src/lib/lib.c
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	*_env = NULL;
 	pool_unref(&env->pool);
 }
+
+void env_deinit(void)
+{
+	if (env_pool != NULL)
+		pool_unref(&env_pool);
+}
--- 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 @@
 /* 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
--- 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)
 {
 	data_stack_deinit();
-        failures_deinit();
+	env_deinit();
+	failures_deinit();
 }