Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a vicious bug in dictionaries inducing that some elements were not freed on xbt_d...
[simgrid.git] / src / xbt / dict.c
index d81b96b..1ef05f0 100644 (file)
@@ -80,7 +80,9 @@ void xbt_dict_free(xbt_dict_t * dict)
   if (dict != NULL && *dict != NULL) {
     table_size = (*dict)->table_size;
     table = (*dict)->table;
-    for (i = 0; (*dict)->count && i < table_size; i++) {
+    /* Warning: the size of the table is 'table_size+1'...
+     * This is because table_size is used as a binary mask in xbt_dict_rehash */
+    for (i = 0; (*dict)->count && i <= table_size; i++) {
       current = table[i];
       while (current != NULL) {
         previous = current;