From efbb35824e3845c3cdefea328dd1bf67d0f9087d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 4 Apr 2011 16:46:21 +0200 Subject: talloc: use VALGRIND_MAKE_MEM_UNDEFINED() before memmove() metze Signed-off-By: Andrew Tridgell --- lib/talloc/talloc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/talloc') diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 4aa85d068c4..8dec01fd412 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -1321,6 +1321,18 @@ _PUBLIC_ void *_talloc_realloc(const void *context, void *ptr, size_t size, cons if (space_left >= space_needed) { size_t old_used = TC_HDR_SIZE + tc->size; pool_tc->pool = TC_POOL_FIRST_CHUNK(pool_tc); +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED) + /* + * we need to prepare the memmove into + * the unaccessable area. + */ + { + size_t diff = PTR_DIFF(tc, pool_tc->pool); + size_t flen = MIN(diff, old_used); + char *fptr = (char *)pool_tc->pool; + VALGRIND_MAKE_MEM_UNDEFINED(fptr, flen); + } +#endif memmove(pool_tc->pool, tc, old_used); new_ptr = pool_tc->pool; -- cgit