You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2007/10/17 06:14:39 UTC

svn commit: r585357 - /apr/apr/trunk/memory/unix/apr_pools.c

Author: wrowe
Date: Tue Oct 16 21:14:34 2007
New Revision: 585357

URL: http://svn.apache.org/viewvc?rev=585357&view=rev
Log:
Complete commit 488084; not only the documentation, but detection of underflow!

PR: 40955
Submitted by: Peter Steiner <peter.steiner+apache hugwi.ch>

Modified:
    apr/apr/trunk/memory/unix/apr_pools.c

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=585357&r1=585356&r2=585357&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Tue Oct 16 21:14:34 2007
@@ -368,7 +368,10 @@
                 max_index = index;
             }
             allocator->free[index] = node;
-            current_free_index -= index;
+            if (current_free_index >= index)
+                current_free_index -= index;
+            else
+                current_free_index = 0;
         }
         else {
             /* This node is too large to keep in a specific size bucket,
@@ -376,7 +379,10 @@
              */
             node->next = allocator->free[0];
             allocator->free[0] = node;
-            current_free_index -= index;
+            if (current_free_index >= index)
+                current_free_index -= index;
+            else
+                current_free_index = 0;
         }
     } while ((node = next) != NULL);