Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : memset 0 on free block/fragment
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 9 Jul 2012 12:45:37 +0000 (14:45 +0200)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Tue, 10 Jul 2012 14:13:57 +0000 (16:13 +0200)
src/xbt/mmalloc/mfree.c

index f452a9e..fae6ed0 100644 (file)
@@ -50,6 +50,8 @@ void mfree(struct mdesc *mdp, void *ptr)
       mdp -> heapinfo[block].busy_block.size * BLOCKSIZE;
     mdp -> heapstats.bytes_free +=
       mdp -> heapinfo[block].busy_block.size * BLOCKSIZE;
       mdp -> heapinfo[block].busy_block.size * BLOCKSIZE;
     mdp -> heapstats.bytes_free +=
       mdp -> heapinfo[block].busy_block.size * BLOCKSIZE;
+
+    memset(ptr, 0, mdp -> heapinfo[block].busy_block.size * BLOCKSIZE);
     
     /* Find the free cluster previous to this one in the free list.
        Start searching at the last block referenced; this may benefit
     
     /* Find the free cluster previous to this one in the free list.
        Start searching at the last block referenced; this may benefit
@@ -144,6 +146,8 @@ void mfree(struct mdesc *mdp, void *ptr)
     mdp -> heapstats.chunks_free++;
     mdp -> heapstats.bytes_free += 1 << type;
 
     mdp -> heapstats.chunks_free++;
     mdp -> heapstats.bytes_free += 1 << type;
 
+    memset(ptr, 0, 1 << type);
+
     
     /* Get the address of the first free fragment in this block.  */
     prev = (struct list *)
     
     /* Get the address of the first free fragment in this block.  */
     prev = (struct list *)