X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fstore.c;h=4603742350443bd1f643778da6e0647a1e6fbf29;hb=33191679e1a86ba6d9c38a74d0795d00c300f2c5;hp=52fabe7566a6e3d3cf8f664ae14754f3952e1af0;hpb=c988f1f4faa9f679f79beddf3c14676c5dcb8e28;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/store.c b/src/src/store.c index 52fabe756..460374235 100644 --- a/src/src/store.c +++ b/src/src/store.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/store.c,v 1.2 2005/01/04 10:00:42 ph10 Exp $ */ +/* $Cambridge: exim/src/src/store.c,v 1.5 2009/11/16 19:50:37 nm4 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2005 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ /* Exim gets and frees all its store through these functions. In the original @@ -41,6 +41,7 @@ The following different types of store are recognized: #include "exim.h" +#include "memcheck.h" /* We need to know how to align blocks of data for general use. I'm not sure @@ -175,6 +176,7 @@ if (size > yield_length[store_pool]) yield_length[store_pool] = newblock->length; next_yield[store_pool] = (void *)((char *)current_block[store_pool] + ALIGNED_SIZEOF_STOREBLOCK); + VALGRIND_MAKE_MEM_NOACCESS(next_yield[store_pool], yield_length[store_pool]); } /* There's (now) enough room in the current block; the yield is the next @@ -199,6 +201,7 @@ DEBUG(D_memory) } #endif /* COMPILE_UTILITY */ +VALGRIND_MAKE_MEM_UNDEFINED(store_last_get[store_pool], size); /* Update next pointer and number of bytes left in the current block. */ next_yield[store_pool] = (void *)((char *)next_yield[store_pool] + size); @@ -293,6 +296,7 @@ DEBUG(D_memory) if (newsize % alignment != 0) newsize += alignment - (newsize % alignment); next_yield[store_pool] = (char *)ptr + newsize; yield_length[store_pool] -= newsize - rounded_oldsize; +VALGRIND_MAKE_MEM_UNDEFINED(ptr + oldsize, inc); return TRUE; } @@ -351,6 +355,7 @@ newlength = bc + b->length - (char *)ptr; #ifndef COMPILE_UTILITY if (running_in_test_harness) memset(ptr, 0xF0, newlength); #endif +VALGRIND_MAKE_MEM_NOACCESS(ptr, newlength); yield_length[store_pool] = newlength - (newlength % alignment); next_yield[store_pool] = (char *)ptr + (newlength % alignment); current_block[store_pool] = b; @@ -362,7 +367,10 @@ flapping memory. However, keep this block only when it has the default size. */ if (yield_length[store_pool] < STOREPOOL_MIN_SIZE && b->next != NULL && b->next->length == STORE_BLOCK_SIZE) + { b = b->next; + VALGRIND_MAKE_MEM_NOACCESS((char *)b + ALIGNED_SIZEOF_STOREBLOCK, b->length - ALIGNED_SIZEOF_STOREBLOCK); + } bb = b->next; b->next = NULL;