# HG changeset patch # User Timo Sirainen # Date 1249235612 14400 # Node ID 19d851d93f924f0c24bd7104d245a31c2ee69e4f # Parent 693fa1d6160a2b6a476c0baf52b760b0138a63bc lib_deinit() now frees memory used by env_put(). 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 @@ *_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 @@ /* 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 @@ -28,5 +29,6 @@ void lib_deinit(void) { data_stack_deinit(); - failures_deinit(); + env_deinit(); + failures_deinit(); }