apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bert Huijben" <b...@qqmail.nl>
Subject Hashtable data freed before pool cleanup
Date Thu, 07 Jan 2010 15:12:06 GMT


Looking at apr's 1.3.x branch:


In r817810 a change to the hash table implementation was introduced, which
moves the data of a hash table from the main pool to a subpool (as seen from
the pool passed to apr_hash_make). This makes the contents of the hashtable
unavailable from pool cleanup handlers registered on that same pool.
(subpools are cleared before the cleanup handlers of the pool itself)


For Subversion this is a breaking change as we commonly use pool cleanup
handlers which read hashtables. (E.g. we close the open data files by
iterating a hash in the cleanup handler)


Switching to this apr version (once released) will make our code use
pointers to already freed memory.


A valid alternative would be to allocate a subpool in the parent pool of the
pool passed to apr_hash_make, and clearing/destroying that pool via a
cleanup handler once the passed pool is cleared. (Or just keeping the old
behavior of realocating in the same pool).



View raw message