httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: [PATCH] ap_clear_pool + userdata
Date Mon, 22 May 2000 05:59:05 GMT
Good catch. Your analysis seems correct, so I've applied the patch.

Cheers,
-g

On Mon, 22 May 2000, Tim  Costello wrote:
> Hello again,
> 
> In ap_set_userdata, memory for the prog_data element of each pool is allocated
> from the pool itself. This is presumably because the userdata is only supposed 
> to live as long as the pool, and then be cleaned up and deleted. 
> 
> ap_clear_pool frees all the memory associated with the pool, but doesn't set 
> the prog_data element to NULL. This causes a situation where a pool has been 
> cleared but is then reused. prog_data still points to the old memory, which 
> isn't necessarily owned by apache anymore, and even if it is, it's probably 
> being used for something else. 
> 
> Here is a patch to fix the problem - can someone knowledgable in APR comment 
> on its correctness and/or commit?
> 
> Thanks,
> Tim
> 
> ===== BEGIN PATCH =====
> --- c:/srclib/repos/apache/2.0/src/src/lib/apr/lib/apr_pools.c	Mon May 22 09:14:23 2000
> +++ src/lib/apr/lib/apr_pools.c	Mon May 22 14:49:29 2000
> @@ -726,6 +726,7 @@
>      a->subprocesses = NULL;
>      free_blocks(a->first->h.next);
>      a->first->h.next = NULL;
> +    a->prog_data = NULL;
>  
>      a->last = a->first;
>      a->first->h.first_avail = a->free_first_avail;
> ===== END PATCH =====
> This message was sent through MyMail http://www.mymail.com.au
> 
> 

-- 
Greg Stein, http://www.lyra.org/


Mime
View raw message