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

Re: [PATCH] Fix memory leak like situation when parsing a svn_config_t object repeatedly

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-07-24 03:11:03 CEST

Greg Hudson <ghudson@MIT.EDU> writes:

> On Sat, 2005-07-23 at 23:24 +0000, Bernd Rinn wrote:
>> When using the functions svn_config_enumerate() and
>> svn_config_enumerate_sections() in libsvn_subr repeatedly on the same cfg, I
>> ran into the problem that memory usage increased with every function
>> call.
>
> svn_config_enumerate is allowed to allocate memory; that's why you pass
> it a pool.

Neither svn_config_enumerate nor svn_config_enumerate_sections get
passed a pool, they use the one in svn_config_t.

>> Here you can see that memory is allocated only if p != NULL, otherwise the
>> attribute 'iterator' of apr_pool_t is used which is perfectly fine from what I
>> can see.
>
> That's not safe; two iterations on the same hash table would collide.

We could make the enumerate functions use a subpool, they do iterate
after all, or we could rev the API to include a pool.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jul 24 03:12:01 2005

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