]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Improved support for VALGRIND_MALLOCLIKE_BLOCK in memcheck: error
authorBart Van Assche <bvanassche@acm.org>
Thu, 2 Sep 2010 10:24:49 +0000 (10:24 +0000)
committerBart Van Assche <bvanassche@acm.org>
Thu, 2 Sep 2010 10:24:49 +0000 (10:24 +0000)
messages printed for client-annotated blocks do now include a correct
address description. Closes #237371.

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

memcheck/mc_malloc_wrappers.c

index 4466aa5256c1f38421c4c5901b39bad271a07746..8b0ced68261ef1c529d4d7258c812f3473ceb975 100644 (file)
@@ -120,7 +120,8 @@ static void add_to_freed_queue ( MC_Chunk* mc )
       mc1->next = NULL; /* just paranoia */
 
       /* free MC_Chunk */
-      VG_(cli_free) ( (void*)(mc1->data) );
+      if (MC_AllocCustom != mc1->allockind)
+         VG_(cli_free) ( (void*)(mc1->data) );
       VG_(free) ( mc1 );
    }
 }
@@ -290,14 +291,10 @@ void die_and_free_mem ( ThreadId tid, MC_Chunk* mc, SizeT rzB )
       accessible with a client request... */
    MC_(make_mem_noaccess)( mc->data-rzB, mc->szB + 2*rzB );
 
-   /* Put it out of harm's way for a while, if not from a client request */
-   if (MC_AllocCustom != mc->allockind) {
-      /* Record where freed */
-      mc->where = VG_(record_ExeContext) ( tid, 0/*first_ip_delta*/ );
-      add_to_freed_queue ( mc );
-   } else {
-      VG_(free) ( mc );
-   }
+   /* Record where freed */
+   mc->where = VG_(record_ExeContext) ( tid, 0/*first_ip_delta*/ );
+   /* Put it out of harm's way for a while */
+   add_to_freed_queue ( mc );
 }
 
 void MC_(handle_free) ( ThreadId tid, Addr p, UInt rzB, MC_AllocKind kind )