Author: ivan
Date: Wed Mar 4 17:43:20 2015
New Revision: 1664084
URL: http://svn.apache.org/r1664084
Log:
Follow-up to r1554807: Fix unbounded memory usage.
* subversion/libsvn_repos/rev_hunt.c
(svn_repos_deleted_rev): Reduce scope of COPY_ROOT and COPY_PATH local
variables to make code more clear about their lifetime. Use SUBPOOL
for temporary allocations in the loop: it restores pre r1554807
memory usage characteristics.
Modified:
subversion/trunk/subversion/libsvn_repos/rev_hunt.c
Modified: subversion/trunk/subversion/libsvn_repos/rev_hunt.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/rev_hunt.c?rev=1664084&r1=1664083&r2=1664084&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/trunk/subversion/libsvn_repos/rev_hunt.c Wed Mar 4 17:43:20 2015
@@ -311,8 +311,7 @@ svn_repos_deleted_rev(svn_fs_t *fs,
apr_pool_t *pool)
{
apr_pool_t *subpool;
- svn_fs_root_t *start_root, *root, *copy_root;
- const char *copy_path;
+ svn_fs_root_t *start_root, *root;
svn_revnum_t mid_rev;
svn_node_kind_t kind;
svn_fs_node_relation_t node_relation;
@@ -379,6 +378,8 @@ svn_repos_deleted_rev(svn_fs_t *fs,
root, path, pool));
if (node_relation != svn_fs_node_unrelated)
{
+ svn_fs_root_t *copy_root;
+ const char *copy_path;
SVN_ERR(svn_fs_closest_copy(©_root, ©_path, root,
path, pool));
if (!copy_root ||
@@ -440,7 +441,7 @@ svn_repos_deleted_rev(svn_fs_t *fs,
/* Get revision root and node id for mid_rev at that revision. */
SVN_ERR(svn_fs_revision_root(&root, fs, mid_rev, subpool));
- SVN_ERR(svn_fs_check_path(&kind, root, path, pool));
+ SVN_ERR(svn_fs_check_path(&kind, root, path, subpool));
if (kind == svn_node_none)
{
/* Case D: Look lower in the range. */
@@ -449,13 +450,15 @@ svn_repos_deleted_rev(svn_fs_t *fs,
}
else
{
+ svn_fs_root_t *copy_root;
+ const char *copy_path;
/* Determine the relationship between the start node
and the current node. */
SVN_ERR(svn_fs_node_relation(&node_relation, start_root, path,
- root, path, pool));
+ root, path, subpool));
if (node_relation != svn_fs_node_unrelated)
- SVN_ERR(svn_fs_closest_copy(©_root, ©_path, root,
- path, subpool));
+ SVN_ERR(svn_fs_closest_copy(©_root, ©_path, root,
+ path, subpool));
if (node_relation == svn_fs_node_unrelated ||
(copy_root &&
(svn_fs_revision_root_revision(copy_root) > start)))