You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/01/19 17:39:47 UTC
svn commit: r1653045 -
/subversion/trunk/subversion/svndumpfilter/svndumpfilter.c
Author: julianfoad
Date: Mon Jan 19 16:39:47 2015
New Revision: 1653045
URL: http://svn.apache.org/r1653045
Log:
Fix a pool usage problem I introduced in r1652987.
* subversion/svndumpfilter/svndumpfilter.c
(headers_dup): New.
(new_revision_record): Duplicate the incoming headers before storing them.
Modified:
subversion/trunk/subversion/svndumpfilter/svndumpfilter.c
Modified: subversion/trunk/subversion/svndumpfilter/svndumpfilter.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svndumpfilter/svndumpfilter.c?rev=1653045&r1=1653044&r2=1653045&view=diff
==============================================================================
--- subversion/trunk/subversion/svndumpfilter/svndumpfilter.c (original)
+++ subversion/trunk/subversion/svndumpfilter/svndumpfilter.c Mon Jan 19 16:39:47 2015
@@ -310,6 +310,24 @@ magic_header_record(int version, void *p
}
+/* Return a deep copy of a (char * -> char *) hash. */
+static apr_hash_t *
+headers_dup(apr_hash_t *headers,
+ apr_pool_t *pool)
+{
+ apr_hash_t *new_hash = apr_hash_make(pool);
+ apr_hash_index_t *hi;
+
+ for (hi = apr_hash_first(pool, headers); hi; hi = apr_hash_next(hi))
+ {
+ const char *key = apr_hash_this_key(hi);
+ const char *val = apr_hash_this_val(hi);
+
+ svn_hash_sets(new_hash, apr_pstrdup(pool, key), apr_pstrdup(pool, val));
+ }
+ return new_hash;
+}
+
/* New revision: set up revision_baton, decide if we skip it. */
static svn_error_t *
new_revision_record(void **revision_baton,
@@ -327,7 +345,7 @@ new_revision_record(void **revision_bato
rb->had_dropped_nodes = FALSE;
rb->writing_begun = FALSE;
rb->props = apr_hash_make(pool);
- rb->original_headers = apr_hash_copy(pool, headers);
+ rb->original_headers = headers_dup(headers, pool);
rev_orig = svn_hash_gets(headers, SVN_REPOS_DUMPFILE_REVISION_NUMBER);
rb->rev_orig = SVN_STR_TO_REV(rev_orig);