You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/11/14 14:23:36 UTC

svn commit: r1714317 - in /subversion/trunk/subversion: libsvn_ra_svn/client.c svnserve/serve.c

Author: stefan2
Date: Sat Nov 14 13:23:36 2015
New Revision: 1714317

URL: http://svn.apache.org/viewvc?rev=1714317&view=rev
Log:
Improve pool usage in svnserve and ra_svn.

All callers to the protocol parser now (indirectly) use a short-lived
scratch pool to hold the request data.

* subversion/libsvn_ra_svn/client.c
  (ra_svn_get_locations): Use an ITERPOOL as scratch within the loop.

* subversion/svnserve/serve.c
  (internal_auth_request): Same.

Modified:
    subversion/trunk/subversion/libsvn_ra_svn/client.c
    subversion/trunk/subversion/svnserve/serve.c

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1714317&r1=1714316&r2=1714317&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Sat Nov 14 13:23:36 2015
@@ -1956,6 +1956,7 @@ static svn_error_t *ra_svn_get_locations
   svn_ra_svn_conn_t *conn = sess_baton->conn;
   svn_revnum_t revision;
   svn_boolean_t is_done;
+  apr_pool_t *iterpool;
   int i;
 
   /* Transmit the parameters. */
@@ -1976,12 +1977,14 @@ static svn_error_t *ra_svn_get_locations
   /* Read the hash items. */
   is_done = FALSE;
   *locations = apr_hash_make(pool);
+  iterpool = svn_pool_create(pool);
   while (!is_done)
     {
       svn_ra_svn__item_t *item;
       const char *ret_path;
 
-      SVN_ERR(svn_ra_svn__read_item(conn, pool, &item));
+      svn_pool_clear(iterpool);
+      SVN_ERR(svn_ra_svn__read_item(conn, iterpool, &item));
       if (is_done_response(item))
         is_done = 1;
       else if (item->kind != SVN_RA_SVN_LIST)
@@ -1991,6 +1994,8 @@ static svn_error_t *ra_svn_get_locations
         {
           SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list, "rc",
                                           &revision, &ret_path));
+
+          /* This also makes RET_PATH live in POOL rather than ITERPOOL. */
           ret_path = svn_fspath__canonicalize(ret_path, pool);
           apr_hash_set(*locations, apr_pmemdup(pool, &revision,
                                                sizeof(revision)),
@@ -1998,6 +2003,8 @@ static svn_error_t *ra_svn_get_locations
         }
     }
 
+  svn_pool_destroy(iterpool);
+
   /* Read the response. This is so the server would have a chance to
    * report an error. */
   return svn_error_trace(svn_ra_svn__read_cmd_response(conn, pool, ""));

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1714317&r1=1714316&r2=1714317&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Sat Nov 14 13:23:36 2015
@@ -678,19 +678,26 @@ internal_auth_request(svn_ra_svn_conn_t
 {
   svn_boolean_t success;
   const char *mech, *mecharg;
+  apr_pool_t *iterpool;
 
   SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "success"));
   SVN_ERR(send_mechs(conn, pool, b, required, needs_username));
   SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)c)", b->repository->realm));
+
+  iterpool = svn_pool_create(pool);
   do
     {
+      svn_pool_clear(iterpool);
+
       SVN_ERR(svn_ra_svn__read_tuple(conn, pool, "w(?c)", &mech, &mecharg));
       if (!*mech)
         break;
       SVN_ERR(auth(&success, conn, mech, mecharg, b, required,
-                   needs_username, pool));
+                   needs_username, iterpool));
     }
   while (!success);
+  svn_pool_destroy(iterpool);
+
   return SVN_NO_ERROR;
 }