httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Costello <>
Subject [PATCH] ap_clear_pool + userdata
Date Thu, 01 Jan 1970 00:00:00 GMT
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?


===== 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;
     a->first-> = 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

View raw message