apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bojan Smojver" <bo...@rexursive.com>
Subject Re: svn commit: r677505 - /apr/apr-util/trunk/misc/apr_reslist.c
Date Thu, 17 Jul 2008 11:24:20 GMT
Quoting "Mladen Turk" <mturk@apache.org>:

> So the pool P is not destroyed before its subpools, only
> the callback is called before subpools are destroyed.

True, but that's not what I see as the problem.

Imagine R is a database connection and S a prepared statement that  
depends on R (i.e. uses structures R points to during destruction). If  
R is destroyed (i.e. pointer to it points nowhere after that), any  
attempt to destroy S will give segfaults.

It is a reasonable APR application design to expect that if S  
registered a cleanup with the sub-pool of the pool from which R was  
allocated, that this cleanup will run OK. But, because R was already  
destroyed, this is not true any more.

Can't you just use malloc()/free() in destructor for temporary memory  
needs? Both should be localised to the destructor...


View raw message