DRD: Restored --free-is-write support and fixed the bug that was present in the previous implementation. Still needs further testing though.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11636 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_malloc_wrappers.c b/drd/drd_malloc_wrappers.c
index 7b594ff..1e6e267 100644
--- a/drd/drd_malloc_wrappers.c
+++ b/drd/drd_malloc_wrappers.c
@@ -128,7 +128,7 @@
 
    s_cmalloc_n_frees++;
 
-   mc = VG_(HT_remove)(s_malloc_list, (UWord)p);
+   mc = VG_(HT_lookup)(s_malloc_list, (UWord)p);
    if (mc)
    {
       tl_assert(p == mc->data);
@@ -136,6 +136,7 @@
 	 VG_(cli_free)((void*)p);
       if (mc->size > 0)
          s_stop_using_mem_callback(mc->data, mc->size);
+      VG_(HT_remove)(s_malloc_list, (UWord)p);
       VG_(free)(mc);
       return True;
    }