Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : free memory
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Tue, 19 Mar 2013 15:41:03 +0000 (16:41 +0100)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Tue, 19 Mar 2013 18:28:29 +0000 (19:28 +0100)
src/xbt/mmalloc/mm_diff.c

index a13dc16..bede162 100644 (file)
@@ -774,13 +774,19 @@ int compare_area(void *area1, void* area2, xbt_dynar_t previous){ /* Return code
     }else if((addr_pointed1 > s_heap) && ((char *)addr_pointed1 < (char *)s_heap + STD_HEAP_SIZE) 
            && (addr_pointed2 > s_heap) && ((char *)addr_pointed2 < (char *)s_heap + STD_HEAP_SIZE)){
       res_compare = compare_area(addr_pointed1, addr_pointed2, previous);
     }else if((addr_pointed1 > s_heap) && ((char *)addr_pointed1 < (char *)s_heap + STD_HEAP_SIZE) 
            && (addr_pointed2 > s_heap) && ((char *)addr_pointed2 < (char *)s_heap + STD_HEAP_SIZE)){
       res_compare = compare_area(addr_pointed1, addr_pointed2, previous);
-      if(res_compare != 0)
+      if(res_compare != 0){
+        if(match_pairs)
+          xbt_dynar_free(&previous);
         return res_compare;
         return res_compare;
+      }
     }else{
       j=0;
       while(j<sizeof(void*) && (i + j) < size){
     }else{
       j=0;
       while(j<sizeof(void*) && (i + j) < size){
-        if(memcmp(((char *)area1_to_compare) + i + j, ((char *)area2_to_compare) + i + j , 1) != 0)
+        if(memcmp(((char *)area1_to_compare) + i + j, ((char *)area2_to_compare) + i + j , 1) != 0){
+          if(match_pairs)
+            xbt_dynar_free(&previous);
           return 1;
           return 1;
+        }
         j++;
       }
     }
         j++;
       }
     }
@@ -790,6 +796,7 @@ int compare_area(void *area1, void* area2, xbt_dynar_t previous){ /* Return code
 
   if(match_pairs){
     match_equals(previous);
 
   if(match_pairs){
     match_equals(previous);
+    xbt_dynar_free(&previous);
   }
 
   return 0;
   }
 
   return 0;