From: Marion Guthmuller Date: Tue, 19 Jun 2012 19:28:26 +0000 (+0200) Subject: model-checker : memset 0 on block/fragment allocated with mmalloc X-Git-Tag: v3_8~563^2~4 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cd16070c1dd5297d2101a7e44df089f2e9022549 model-checker : memset 0 on block/fragment allocated with mmalloc --- diff --git a/src/xbt/mmalloc/mmalloc.c b/src/xbt/mmalloc/mmalloc.c index 37f8c6b933..8a636fbf66 100644 --- a/src/xbt/mmalloc/mmalloc.c +++ b/src/xbt/mmalloc/mmalloc.c @@ -169,6 +169,8 @@ void *mmalloc(xbt_mheap_t mdp, size_t size) mdp -> heapstats.bytes_used += 1 << log; mdp -> heapstats.chunks_free--; mdp -> heapstats.bytes_free -= 1 << log; + + memset(result, 0, requested_size); } else { /* No free fragments of the desired size, so get a new block @@ -176,6 +178,7 @@ void *mmalloc(xbt_mheap_t mdp, size_t size) //printf("(%s) No free fragment...",xbt_thread_self_name()); result = mmalloc(mdp, BLOCKSIZE); // does not return NULL + memset(result, 0, requested_size); /* Link all fragments but the first into the free list, and mark their requested size to 0. */ block = BLOCK(result); @@ -234,6 +237,7 @@ void *mmalloc(xbt_mheap_t mdp, size_t size) continue; } result = register_morecore(mdp, blocks * BLOCKSIZE); + memset(result, 0, requested_size); block = BLOCK(result); for (it=0;it