Author: hwright
Date: Wed Jul 20 18:52:43 2011
New Revision: 1148892
URL: http://svn.apache.org/viewvc?rev=1148892&view=rev
Log:
Merge r1148566, r1148853 from trunk:
* r1148566, r1148853
Fix a memory leak in svn merge.
Justification:
Memory leaks are bad.
Votes:
-0: rhuijben (r1148588 fixes the immediate problems and this code can use
a bit more cleanup before backporting. See also the
[email protected] thread for gstein's concerns) (r1148566 only)
+1: stsp (r1148588 alone does *not* fix the leak)
+1: philip, gstein
Modified:
subversion/branches/1.7.x/ (props changed)
subversion/branches/1.7.x/STATUS
subversion/branches/1.7.x/subversion/libsvn_client/merge.c
Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 20 18:52:43 2011
@@ -53,4 +53,4 @@
/subversion/branches/tree-conflicts:868291-873154
/subversion/branches/tree-conflicts-notify:873926-874008
/subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1148071,1148374
+/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1148071,1148374,1148566,1148853
Modified: subversion/branches/1.7.x/STATUS
URL:
http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1148892&r1=1148891&r2=1148892&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Wed Jul 20 18:52:43 2011
@@ -86,14 +86,3 @@ Approved changes:
+1: rhuijben, stsp
+1: gstein (another iteration could make this "nicer", but is not
required for backport)
-
- * r1148566, r1148853
- Fix a memory leak in svn merge.
- Justification:
- Memory leaks are bad.
- Votes:
- -0: rhuijben (r1148588 fixes the immediate problems and this code can use
- a bit more cleanup before backporting. See also the
- [email protected] thread for gstein's concerns) (r1148566 only)
- +1: stsp (r1148588 alone does *not* fix the leak)
- +1: philip, gstein
Modified: subversion/branches/1.7.x/subversion/libsvn_client/merge.c
URL:
http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_client/merge.c?rev=1148892&r1=1148891&r2=1148892&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_client/merge.c Wed Jul 20
18:52:43 2011
@@ -7872,14 +7872,27 @@ log_noop_revs(void *baton,
apr_hash_index_t *hi;
svn_revnum_t revision;
svn_boolean_t log_entry_rev_required = FALSE;
+ apr_array_header_t *rl1;
+ apr_array_header_t *rl2;
+ apr_array_header_t *rangelist;
+
+ /* The baton's pool is essentially an iterpool so we must clear it
+ * for each invocation of this function. */
+ rl1 = svn_rangelist_dup(log_gap_baton->operative_ranges, pool);
+ rl2 = svn_rangelist_dup(log_gap_baton->merged_ranges, pool);
+ svn_pool_clear(log_gap_baton->pool);
+ log_gap_baton->operative_ranges = svn_rangelist_dup(rl1,
+ log_gap_baton->pool);
+ log_gap_baton->merged_ranges = svn_rangelist_dup(rl2,
+ log_gap_baton->pool);
revision = log_entry->revision;
+ rangelist = svn_rangelist__initialize(revision - 1, revision, TRUE,
+ log_gap_baton->pool);
/* Unconditionally add LOG_ENTRY->REVISION to BATON->OPERATIVE_MERGES. */
SVN_ERR(svn_rangelist_merge(&(log_gap_baton->operative_ranges),
- svn_rangelist__initialize(revision - 1,
- revision, TRUE,
- log_gap_baton->pool),
+ rangelist,
log_gap_baton->pool));
/* Examine each path affected by LOG_ENTRY->REVISION. If the explicit or
@@ -7948,10 +7961,7 @@ log_noop_revs(void *baton,
event the inherited mergeinfo is actually non-inheritable. */
SVN_ERR(svn_rangelist_intersect(&intersecting_range,
paths_explicit_rangelist,
- svn_rangelist__initialize(
- revision - 1,
- revision, TRUE,
- pool),
+ rangelist,
mergeinfo_inherited, pool));
if (intersecting_range->nelts == 0)
@@ -7965,10 +7975,7 @@ log_noop_revs(void *baton,
if (!log_entry_rev_required)
SVN_ERR(svn_rangelist_merge(&(log_gap_baton->merged_ranges),
- svn_rangelist__initialize(revision - 1,
- revision,
- TRUE,
- log_gap_baton->pool),
+ rangelist,
log_gap_baton->pool));
return SVN_NO_ERROR;
@@ -8099,7 +8106,7 @@ remove_noop_subtree_ranges(const char *u
result_pool, scratch_pool));
log_gap_baton.merged_ranges = merged_ranges;
log_gap_baton.operative_ranges = operative_ranges;
- log_gap_baton.pool = scratch_pool;
+ log_gap_baton.pool = svn_pool_create(scratch_pool);
APR_ARRAY_PUSH(log_targets, const char *) = "";
@@ -8137,6 +8144,8 @@ remove_noop_subtree_ranges(const char *u
}
}
+ svn_pool_destroy(log_gap_baton.pool);
+
return SVN_NO_ERROR;
}