[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Hashtable data freed before pool cleanup

From: Bert Huijben <bert_at_qqmail.nl>
Date: Thu, 7 Jan 2010 16:12:06 +0100



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).


Received on 2010-01-07 16:12:26 CET

This is an archived mail posted to the Subversion Dev mailing list.