You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rp...@apache.org on 2018/02/05 09:43:55 UTC

svn commit: r1823145 - /apr/apr-util/branches/1.7.x/buckets/apr_buckets_alloc.c

Author: rpluem
Date: Mon Feb  5 09:43:55 2018
New Revision: 1823145

URL: http://svn.apache.org/viewvc?rev=1823145&view=rev
Log:
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

Modified:
    apr/apr-util/branches/1.7.x/buckets/apr_buckets_alloc.c

Modified: apr/apr-util/branches/1.7.x/buckets/apr_buckets_alloc.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/buckets/apr_buckets_alloc.c?rev=1823145&r1=1823144&r2=1823145&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/buckets/apr_buckets_alloc.c (original)
+++ apr/apr-util/branches/1.7.x/buckets/apr_buckets_alloc.c Mon Feb  5 09:43:55 2018
@@ -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