summaryrefslogtreecommitdiff
path: root/buckets
diff options
context:
space:
mode:
authorRuediger Pluem <rpluem@apache.org>2018-01-26 15:24:40 +0000
committerRuediger Pluem <rpluem@apache.org>2018-01-26 15:24:40 +0000
commita70b181b5bf8ee3f4f3401d29e8282fd28caf31e (patch)
treea59c69d5cf9a621dc329df124e54863f0e63f2f4 /buckets
parente7217d0543a16227be6da8da4e5b0dc163946ef7 (diff)
downloadapr-a70b181b5bf8ee3f4f3401d29e8282fd28caf31e.tar.gz
* We cannot access list any longer after we called apr_allocator_free as it points to memory we just freed.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1822315 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'buckets')
-rw-r--r--buckets/apr_buckets_alloc.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/buckets/apr_buckets_alloc.c b/buckets/apr_buckets_alloc.c
index 79ac9293e..a2a25d426 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