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

Re: Bug in libsvn_subr/xml.c

From: David Glasser <glasser_at_davidglasser.net>
Date: 2007-11-15 00:25:59 CET

On Nov 13, 2007 5:49 AM, Xi Wang <xi.wang@gmail.com> wrote:
>
> On Nov 13, 2007 8:38 PM, Erik Huelsmann <ehuels@gmail.com> wrote:
>
> >
> > The memory pointed to by hi isn't really leaked (since its still
> > allocated in a pool); it does have a longer-than-necessary lifetime.
> > Except for passing another pool into svn_xml_make_open_tag - which
> > looks like overkill to me - I don't really see a way to resolve this
> > issue...
> >
>
> I agree that there are seldom "real leaks" when using pools, since pools are
> usually destroyed after some time.
>
> So may the iterator "hi" use the same pool as the hashtable to avoid a
> longer-than-necessary lifetime? For example, pass a null for the pool to
> apr_hash_first at line 568.
>
> apr_hash_index_t * apr_hash_first(apr_pool_t *p, apr_hash_t *ht)
> {
> apr_hash_index_t *hi;
> if (p)
> hi = apr_palloc(p, sizeof(*hi));
> else
> hi = &ht->iterator;
> ...
>
> Xi

I don't know that we should go out of our way to use APIs documented
as not thread-safe...

--dave

-- 
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 15 00:26:11 2007

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