Author: svn-role
Date: Fri Apr 13 04:01:16 2012
New Revision: 1325604
URL: http://svn.apache.org/viewvc?rev=1325604&view=rev
Log:
Merge r1311935 from trunk:
* r1311935
Fix a pool lifetime problem in the diff code.
Justification:
The diff callbacks implementation relies on the diff callback driver to
allocate path arguments from a persistent pool. While this might not be
a problem in 1.7.x we're just lucky if it isn't. The problem should be
fixed before somebody gets hurt.
Votes:
+1: stsp, hwright, philip
Modified:
subversion/branches/1.7.x/ (props changed)
subversion/branches/1.7.x/STATUS
subversion/branches/1.7.x/subversion/libsvn_client/diff.c
Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1311935
Modified: subversion/branches/1.7.x/STATUS
URL:
http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1325604&r1=1325603&r2=1325604&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Fri Apr 13 04:01:16 2012
@@ -144,16 +144,6 @@ Veto-blocked changes:
Approved changes:
=================
- * r1311935
- Fix a pool lifetime problem in the diff code.
- Justification:
- The diff callbacks implementation relies on the diff callback driver to
- allocate path arguments from a persistent pool. While this might not be
- a problem in 1.7.x we're just lucky if it isn't. The problem should be
- fixed before somebody gets hurt.
- Votes:
- +1: stsp, hwright, philip
-
* r1306334
Optimize failure of opening wc.db files.
Justification:
Modified: subversion/branches/1.7.x/subversion/libsvn_client/diff.c
URL:
http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_client/diff.c?rev=1325604&r1=1325603&r2=1325604&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_client/diff.c Fri Apr 13
04:01:16 2012
@@ -812,6 +812,17 @@ struct diff_cmd_baton {
};
+/* A helper function that marks a path as visited. It copies PATH
+ * into the correct pool before referencing it from the hash table. */
+static void
+mark_path_as_visited(struct diff_cmd_baton *diff_cmd_baton, const char *path)
+{
+ const char *p;
+
+ p = apr_pstrdup(apr_hash_pool_get(diff_cmd_baton->visited_paths), path);
+ apr_hash_set(diff_cmd_baton->visited_paths, p, APR_HASH_KEY_STRING, p);
+}
+
/* An helper for diff_dir_props_changed, diff_file_changed and diff_file_added
*/
static svn_error_t *
@@ -859,8 +870,7 @@ diff_props_changed(svn_wc_notify_state_t
/* We've printed the diff header so now we can mark the path as
* visited. */
if (show_diff_header)
- apr_hash_set(diff_cmd_baton->visited_paths, path,
- APR_HASH_KEY_STRING, path);
+ mark_path_as_visited(diff_cmd_baton, path);
}
if (state)
@@ -1056,9 +1066,7 @@ diff_content_changed(const char *path,
subpool));
/* We have a printed a diff for this path, mark it as visited. */
- apr_hash_set(diff_cmd_baton->visited_paths, path,
- APR_HASH_KEY_STRING, path);
-
+ mark_path_as_visited(diff_cmd_baton, path);
}
/* Close the stream (flush) */