apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maxim Yegorushkin" <maxim.yegorush...@gmail.com>
Subject apr_palloc bugfix
Date Tue, 01 Jan 2008 23:07:19 GMT
Hi there,

Looks like apr_palloc can not allocate the last byte from the node. If
so, here is a patch.

p.s. please ignore my previous post, it has been truncated...

[max@k-pax apr]$ svn diff
Index: memory/unix/apr_pools.c
===================================================================
--- memory/unix/apr_pools.c	(revision 607616)
+++ memory/unix/apr_pools.c	(working copy)
@@ -633,7 +633,7 @@
     active = pool->active;

     /* If the active node has enough bytes left, use it. */
-    if (size < (apr_size_t)(active->endp - active->first_avail)) {
+    if (size <= (apr_size_t)(active->endp - active->first_avail)) {
         mem = active->first_avail;
         active->first_avail += size;

@@ -641,7 +641,7 @@
     }

     node = active->next;
-    if (size < (apr_size_t)(node->endp - node->first_avail)) {
+    if (size <= (apr_size_t)(node->endp - node->first_avail)) {
         list_remove(node);
     }
     else {

Mime
View raw message