subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1695019 - /subversion/trunk/subversion/libsvn_ra_svn/editorp.c
Date Mon, 10 Aug 2015 11:02:13 GMT
Author: stefan2
Date: Mon Aug 10 11:02:13 2015
New Revision: 1695019

URL: http://svn.apache.org/r1695019
Log:
Fix segfault in editor drive on ra_svn.

* subversion/libsvn_ra_svn/editorp.c
  (remove_token): New helper function - symmetric to store_token.
  (ra_svn_handle_close_dir,
   ra_svn_handle_close_file): Not only remove the entry from the hash
                              before clearing the pool but also reset
                              the LAST_TOKEN reference.

Reported by: philip.

Modified:
    subversion/trunk/subversion/libsvn_ra_svn/editorp.c

Modified: subversion/trunk/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/editorp.c?rev=1695019&r1=1695018&r2=1695019&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/editorp.c Mon Aug 10 11:02:13 2015
@@ -522,6 +522,18 @@ static svn_error_t *lookup_token(ra_svn_
   return SVN_NO_ERROR;
 }
 
+/* Remove a TOKEN entry from DS. */
+static void remove_token(ra_svn_driver_state_t *ds,
+                         svn_string_t *token)
+{
+  apr_hash_set(ds->tokens, token->data, token->len, NULL);
+
+  /* Reset this unconditionally.  In most cases, LAST_TOKEN->TOKEN will
+     match TOKEN anyway and if it doesn't, lookup_token() will suffer only
+     a minor performance hit. */
+  ds->last_token = NULL;
+}
+
 static svn_error_t *ra_svn_handle_target_rev(svn_ra_svn_conn_t *conn,
                                              apr_pool_t *pool,
                                              const apr_array_header_t *params,
@@ -659,7 +671,7 @@ static svn_error_t *ra_svn_handle_close_
 
   /* Close the directory and destroy the baton. */
   SVN_CMD_ERR(ds->editor->close_directory(entry->baton, pool));
-  apr_hash_set(ds->tokens, token->data, token->len, NULL);
+  remove_token(ds, token);
   svn_pool_destroy(entry->pool);
   return SVN_NO_ERROR;
 }
@@ -838,7 +850,7 @@ static svn_error_t *ra_svn_handle_close_
 
   /* Close the file and destroy the baton. */
   SVN_CMD_ERR(ds->editor->close_file(entry->baton, text_checksum, pool));
-  apr_hash_set(ds->tokens, token->data, token->len, NULL);
+  remove_token(ds, token);
   if (--ds->file_refs == 0)
     svn_pool_clear(ds->file_pool);
   return SVN_NO_ERROR;



Mime
View raw message