[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: Xi Wang <xi.wang_at_gmail.com>
Date: 2007-11-13 14:49:09 CET

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
Received on Tue Nov 13 15:09:37 2007

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.