Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
UNLOCK forgotten before THROWF
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 8 Oct 2012 23:15:23 +0000 (01:15 +0200)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 8 Oct 2012 23:15:44 +0000 (01:15 +0200)
src/xbt/mmalloc/mfree.c

index b264ec3..754ff30 100644 (file)
@@ -40,6 +40,7 @@ void mfree(struct mdesc *mdp, void *ptr)
 
   switch (type) {
   case -1: /* Already free */
+    UNLOCK(mdp);
     THROWF(system_error, 0, "Asked to free a fragment in a block that is already free. I'm puzzled\n");
     break;
     
@@ -152,8 +153,10 @@ void mfree(struct mdesc *mdp, void *ptr)
     /* Set size used in the fragment to 0 */
     frag_nb = RESIDUAL(ptr, BLOCKSIZE) >> type;
 
-    if( mdp->heapinfo[block].busy_frag.frag_size[frag_nb] == 0)
+    if( mdp->heapinfo[block].busy_frag.frag_size[frag_nb] == 0){
+      UNLOCK(mdp);
       THROWF(system_error, 0, "Asked to free a fragment that is already free. I'm puzzled\n");
+    }
 
     mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = 0;