]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
drd, realloc() intercept: Swap freeing and cleaning memory.
authorBart Van Assche <bvanassche@acm.org>
Mon, 2 Apr 2012 15:46:51 +0000 (15:46 +0000)
committerBart Van Assche <bvanassche@acm.org>
Mon, 2 Apr 2012 15:46:51 +0000 (15:46 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12482

drd/drd_malloc_wrappers.c

index 92e14d7e1f8c2be6e9fc43cb04251bfe9fc28ff4..3abdf0ef1c5f577ecc7011d2e29782f99c7feebc 100644 (file)
@@ -228,9 +228,9 @@ static void* drd_realloc(ThreadId tid, void* p_old, SizeT new_size)
          VG_(memcpy)(p_new, p_old, mc->size);
 
          /* Free old memory. */
-         VG_(cli_free)(p_old);
          if (mc->size > 0)
             s_stop_using_mem_callback(mc->data, mc->size);
+         VG_(cli_free)(p_old);
          VG_(HT_remove)(s_malloc_list, (UWord)p_old);
 
          /* Update state information. */