svn commit: r1935310 - apr/apr/trunk/memory/unix
[email protected] Sun, 14 Jun 2026 16:09:53 -0000
| Newsgroups | gmane.comp.apache.apr.cvs |
|---|---|
| Message-ID | <178145339326.1789562.8969815248737758650@svn03-he-fi> |
Author: brane
Date: Sun Jun 14 16:09:53 2026
New Revision: 1935310
Log:
Follow up to r1935301: Fix an imprecise for destroying an allocator.
Modified:
apr/apr/trunk/memory/unix/apr_pools.c
Modified: apr/apr/trunk/memory/unix/apr_pools.c
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c Sun Jun 14 15:54:06 2026 (r1935309)
+++ apr/apr/trunk/memory/unix/apr_pools.c Sun Jun 14 16:09:53 2026 (r1935310)
@@ -1057,13 +1057,13 @@ static apr_status_t create_pool(apr_pool
apr_abortfunc_t abort_fn,
apr_allocator_t *allocator)
{
- const int need_allocator = (allocator == NULL);
+ const int create_unmanaged_pool = (parent == NULL);
+ const int need_new_allocator = (allocator == NULL);
apr_pool_t *pool;
apr_memnode_t *node;
- if (!parent) {
- /* We're creating an unmanaged pool. */
- if (need_allocator) {
+ if (create_unmanaged_pool) {
+ if (need_new_allocator) {
if (apr_allocator_create(&allocator) != APR_SUCCESS) {
if (abort_fn)
abort_fn(APR_ENOMEM);
@@ -1076,7 +1076,7 @@ static apr_status_t create_pool(apr_pool
if (!abort_fn)
abort_fn = parent->abort_fn;
- if (need_allocator)
+ if (need_new_allocator)
allocator = parent->allocator;
}
@@ -1085,7 +1085,7 @@ static apr_status_t create_pool(apr_pool
if (abort_fn)
abort_fn(APR_ENOMEM);
- if (need_allocator && allocator != NULL) {
+ if (create_unmanaged_pool && need_new_allocator && allocator != NULL) {
/* We created a new allocator but can't allocate, so destroy it. */
apr_allocator_destroy(allocator);
}