On Mon, Jan 29, 2018 at 8:31 AM, Ruediger Pluem <rpl...@apache.org> wrote:
>
>
> On 01/26/2018 10:42 PM, Yann Ylavic wrote:
>> On Fri, Jan 26, 2018 at 4:24 PM,  <rpl...@apache.org> wrote:
>>>
>>> Modified: apr/apr/trunk/buckets/apr_buckets_alloc.c
>>> URL: 
>>> http://svn.apache.org/viewvc/apr/apr/trunk/buckets/apr_buckets_alloc.c?rev=1822315&r1=1822314&r2=1822315&view=diff
>>> ==============================================================================
>>> --- apr/apr/trunk/buckets/apr_buckets_alloc.c (original)
>>> +++ apr/apr/trunk/buckets/apr_buckets_alloc.c Fri Jan 26 15:24:40 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
>>
>> Since apr_allocator_destroy() will free all its nodes, maybe we can simply:
>>
>> #if APR_POOL_DEBUG
>>     if (list->pool && list->allocator != apr_pool_allocator_get(list->pool)) 
>> {
>>         apr_allocator_destroy(allocator);
>>     }
>>     else
>> #endif
>>     apr_allocator_free(list->allocator, list->blocks);
>
> This should be possible as well, but I wanted to keep the code of the debug 
> mode as close as possible
> to the non debug mode.

Fair enough, thanks.


Regards,
Yann.

Reply via email to