dovecot-2.0: DEBUG: i_free() now clears the memory before freein...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Dec 22 21:20:02 EET 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/19787c343ef1
changeset: 10522:19787c343ef1
user: Timo Sirainen <tss at iki.fi>
date: Tue Dec 22 14:19:15 2009 -0500
description:
DEBUG: i_free() now clears the memory before freeing it.
diffstat:
1 file changed, 6 insertions(+)
src/lib/mempool-system.c | 6 ++++++
diffs (30 lines):
diff -r 76af32fae1e2 -r 19787c343ef1 src/lib/mempool-system.c
--- a/src/lib/mempool-system.c Tue Dec 22 12:51:37 2009 -0500
+++ b/src/lib/mempool-system.c Tue Dec 22 14:19:15 2009 -0500
@@ -3,6 +3,7 @@
/* @UNSAFE: whole file */
#include "lib.h"
+#include "safe-memset.h"
#include "mempool.h"
#include <stdlib.h>
@@ -19,6 +20,8 @@
#elif defined (HAVE_GC_H)
# include <gc.h>
#endif
+
+#define CLEAR_CHR 0xde
static const char *pool_system_get_name(pool_t pool);
static void pool_system_ref(pool_t pool);
@@ -89,6 +92,9 @@ static void pool_system_free(pool_t pool
static void pool_system_free(pool_t pool ATTR_UNUSED,
void *mem ATTR_UNUSED)
{
+#if !defined(USE_GC) && defined(HAVE_MALLOC_USABLE_SIZE) && defined(DEBUG)
+ safe_memset(mem, CLEAR_CHR, malloc_usable_size(mem));
+#endif
#ifndef USE_GC
free(mem);
#endif
More information about the dovecot-cvs
mailing list