apr-util/Merge-r1822315-from-trunk.patch
2019-12-25 15:41:44 +08:00

47 lines
1.4 KiB
Diff

From aecf1eb280326484a58b21c68a18373f7c17872e Mon Sep 17 00:00:00 2001
From: Ruediger Pluem <rpluem@apache.org>
Date: Mon, 5 Feb 2018 09:44:16 +0000
Subject: [PATCH 05/15] Merge r1822315 from trunk:
* We cannot access list any longer after we called apr_allocator_free as it points to memory we just freed.
Reviewed by: rpluem
git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/1.6.x@1823146 13f79535-47bb-0310-9956-ffa450edef68
---
buckets/apr_buckets_alloc.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/buckets/apr_buckets_alloc.c b/buckets/apr_buckets_alloc.c
index e5838dd0..2d6f214e 100644
--- a/buckets/apr_buckets_alloc.c
+++ b/buckets/apr_buckets_alloc.c
@@ -45,12 +45,21 @@ struct apr_bucket_alloc_t {
static apr_status_t alloc_cleanup(void *data)
{
apr_bucket_alloc_t *list = data;
+#if APR_POOL_DEBUG
+ apr_allocator_t *allocator = NULL;
+#endif
+
+#if APR_POOL_DEBUG
+ if (list->pool && list->allocator != apr_pool_allocator_get(list->pool)) {
+ allocator = list->allocator;
+ }
+#endif
apr_allocator_free(list->allocator, list->blocks);
#if APR_POOL_DEBUG
- if (list->pool && list->allocator != apr_pool_allocator_get(list->pool)) {
- apr_allocator_destroy(list->allocator);
+ if (allocator) {
+ apr_allocator_destroy(allocator);
}
#endif
--
2.19.1