From 49dd5ef3a3d1775fdc3c0a7d069d3097b3baeeec Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 7 Nov 2012 16:09:58 -0500 Subject: Add and use and unlikely-to-be-eliminated memwipe() Apparently some compilers like to eliminate memset() operations on data that's about to go out-of-scope. I've gone with the safest possible replacement, which might be a bit slow. I don't think this is critical path in any way that will affect performance, but if it is, we can work on that in 0.2.4. Fixes bug 7352. --- src/common/mempool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/common/mempool.c') diff --git a/src/common/mempool.c b/src/common/mempool.c index 2416bce473..637f081c88 100644 --- a/src/common/mempool.c +++ b/src/common/mempool.c @@ -8,6 +8,7 @@ #include #include #include "torint.h" +#include "crypto.h" #define MEMPOOL_PRIVATE #include "mempool.h" @@ -519,7 +520,7 @@ mp_pool_destroy(mp_pool_t *pool) destroy_chunks(pool->empty_chunks); destroy_chunks(pool->used_chunks); destroy_chunks(pool->full_chunks); - memset(pool, 0xe0, sizeof(mp_pool_t)); + memwipe(pool, 0xe0, sizeof(mp_pool_t)); FREE(pool); } -- cgit v1.2.3-54-g00ecf