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...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 16 Oct 2009 09:06:55 +0000 (09:06 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 16 Oct 2009 09:06:55 +0000 (09:06 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6799 48e7efb5-ca39-0410-a469-dd3cf9ba447f

ChangeLog
src/xbt/dict.c

index d90ded4..65499d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -111,6 +111,8 @@ SimGrid (3.3.4) unstable; urgency=low
    Introduce a MSG_TIMEOUT_FAILURE return code and use it consistently.
  * Integrate patch #8636: Obey DESTDIR when installing documentation.
    Thanks to Robson Peixoto.
+ * Fix a vicious bug in dictionaries inducing that some elements were
+   not freed on xbt_dict_free()
 
  -- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr> 
 
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;