gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r9687 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r9687 - gnunet/src/util
Date: Thu, 3 Dec 2009 02:44:18 +0100

Author: nevans
Date: 2009-12-03 02:44:18 +0100 (Thu, 03 Dec 2009)
New Revision: 9687

Modified:
   gnunet/src/util/container_heap.c
Log:
heap bugfix

Modified: gnunet/src/util/container_heap.c
===================================================================
--- gnunet/src/util/container_heap.c    2009-12-02 23:22:08 UTC (rev 9686)
+++ gnunet/src/util/container_heap.c    2009-12-03 01:44:18 UTC (rev 9687)
@@ -326,6 +326,8 @@
   ret = del_node->element;
   last = getPos (root, root->size);
 
+  root->size--;
+
   old_cost = del_node->cost;
   del_node->element = last->element;
   del_node->cost = last->cost;
@@ -339,9 +341,15 @@
     {
       root->traversal_pos = root->root;
     }
+
+  if (last == del_node)
+  {
+    GNUNET_free (last);
+    return ret;
+  }
   GNUNET_free (last);
-  root->size--;
 
+
   if (del_node->cost > old_cost)
     {
       if (root->type == GNUNET_CONTAINER_HEAP_ORDER_MAX)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]