[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: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2005-07-24 02:24:06 CEST

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. See http://subversion.tigris.org/hacking.html#apr-pools for
how to call functions like this in a loop without leaking memory.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jul 24 02:26:56 2005

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.