]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a followup comment to the changes in r8454, which made memcheck's
authorJulian Seward <jseward@acm.org>
Tue, 29 Jul 2008 09:44:52 +0000 (09:44 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 29 Jul 2008 09:44:52 +0000 (09:44 +0000)
client realloc function use an always-move strategy.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8469

memcheck/mc_malloc_wrappers.c

index cfc1e57ac57fabd79d08cf05b4c5f6a9d7c1869e..07cb484adbc49dd5adc55d3be6fae1d61b8459c6 100644 (file)
@@ -372,6 +372,14 @@ void* MC_(realloc) ( ThreadId tid, void* p_old, SizeT new_szB )
 
    old_szB = mc->szB;
 
+   /* In all cases, even when the new size is smaller or unchanged, we
+      reallocate and copy the contents, and make the old block
+      inaccessible.  This is so as to guarantee to catch all cases of
+      accesses via the old address after reallocation, regardless of
+      the change in size.  (Of course the ability to detect accesses
+      to the old block also depends on the size of the freed blocks
+      queue). */
+
    if (new_szB <= old_szB) {
       /* new size is smaller or the same */
       Addr a_new;