drd, free() intercept: Swap freeing and cleaning memory.

Note: since the big lock is held while the malloc() and free() intercepts are
running, and since mmap() is treated by Valgrind as a non-blocking system call,
this code change is not expected to result in a behavior change of drd.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12478 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_malloc_wrappers.c b/drd/drd_malloc_wrappers.c
index 6eaa674..92e14d7 100644
--- a/drd/drd_malloc_wrappers.c
+++ b/drd/drd_malloc_wrappers.c
@@ -131,10 +131,10 @@
    if (mc)
    {
       tl_assert(p == mc->data);
-      if (dealloc)
-	 VG_(cli_free)((void*)p);
       if (mc->size > 0)
          s_stop_using_mem_callback(mc->data, mc->size);
+      if (dealloc)
+	 VG_(cli_free)((void*)p);
       VG_(HT_remove)(s_malloc_list, (UWord)p);
       VG_(free)(mc);
       return True;