[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: Bernd Rinn <bernd_at_sdf.lonestar.org>
Date: 2005-07-24 19:05:38 CEST

Greg Hudson wrote:
> On Sun, 2005-07-24 at 10:41 +0200, Bernd Rinn wrote:
>
>>>The standard workaround for having to use a baton pool instead of a
>>>passed-in pool is to use a subpool of the baton pool, yes. Since we're
>>>iterating here, it isn't even terribly awkward. But yes, the API should
>>>include a pool, although it's not terribly important.
>>
>>Maybe I explain the use case so that you can see it is a useful one:
>
>
> I wasn't disputing the usefulness of your use case; the "workaround" is
> for us, because we have a broken API, not you.
>
> I've committed r15404 with the workaround. I'll leave it to someone
> else to code up the better long-term fix of revving the enumerate APIs.

OK, I'll try. Please let me know if anything is inappropriate or needs
to be changed.

The changes are split in two parts: the first one revvs the API, the
second one makes use of the new revision in order to replace calls to
deprecated functions. The first patch can be applied independently of
the second one.

Log message for svn_config_enumerate_pool_1.3_api.patch:

[[[
Create revision 2 of the API of function svn_config_enumerate() and
svn_config_enumerate_sections().

Patch by: Bernd Rinn <bernd@sdf.lonestar.org>

* subversion/libsvn_subr/config.c
  (svn_config_enumerate2): New. Copy of svn_config_enumerate() with
cfg->x_pool replaced by the pool provided.
  (svn_config_sections2): New. Copy of svn_config_enumerate_sections()
with cfg->x_pool replaced by the pool provided.
  (svn_config_enumerate): Deprecated. Create subpool of cfg->x_pool and
call svn_config_enumerate2().
    apr_hash_first().
  (svn_config_sections): Deprecated. Create subpool of cfg->x_pool and
call svn_config_enumerate_sections2().

* subversion/include/svn_config.h
  (svn_config_enumerate2): New.
  (svn_config_sections2): New.
  (svn_config_enumerate): Deprecated.
    apr_hash_first().
  (svn_config_sections): Deprecated.

]]]

Log message for
svn_config_enumerate_pool_1.3_replace_deprecated_functioncalls.patch:

[[[
Replace calls to deprecated revision 1 of functions
svn_config_enumerate() and svn_config_sections() by calls to revision 2.

Patch by: Bernd Rinn <bernd@sdf.lonestar.org>

* subversion/libsvn_client/add.c
  (svn_client__get_auto_props): Replace call to svn_config_enumerate
with call to svn_config_enumerate2().

* subversion/libsvn_repos/authz.c
  (authz_parse_section):
  (authz_get_path_access):
  (authz_get_tree_access):
  (authz_validate_section):
  (svn_repos_authz_read): Replace calls to svn_config_enumerate with
call to svn_config_enumerate2(), and calls to
svn_config_enumerate_sections() with calls to
svn_config_enumerate_sections2().
]]]

> Although r15404 is suitable for backporting, I haven't proposed it for
> any previous revs because only a small amount of memory is leaked per
> call, and that generally isn't a problem. Since you're using APIs which
> postdate 1.2.x, I'm guessing you don't particularly need a backport, but
> if you do want one, speak up.

The backport to 1.2.x is not important to me since I am building the
RPMs myself and applying a patch is easy.

--
Bernd Rinn



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Sun Jul 24 19:10:02 2005

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