subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1148588 - /subversion/trunk/subversion/libsvn_ra_serf/log.c
Date Wed, 20 Jul 2011 00:40:13 GMT
Author: rhuijben
Date: Wed Jul 20 00:40:12 2011
New Revision: 1148588

URL: http://svn.apache.org/viewvc?rev=1148588&view=rev
Log:
Make ra_serf use a subpool for every log item instead of storing all of them
in the same pool. This also makes the pool passed to the log receiver a
proper scratch pool.

* subversion/libsvn_ra_serf/log.c
  (push_state): Create a subpool for the log item and everything inside.
  (start_log): Copy string into the info pool. Fixes a possible pointer
    lifetime issue.
  (end_log): Destroy the subpool when popping the item from the xml state.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/log.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/log.c?rev=1148588&r1=1148587&r2=1148588&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/log.c Wed Jul 20 00:40:12 2011
@@ -121,11 +121,12 @@ push_state(svn_ra_serf__xml_parser_t *pa
   if (state == ITEM)
     {
       log_info_t *info;
+      apr_pool_t *info_pool = svn_pool_create(parser->state->pool);
 
-      info = apr_pcalloc(parser->state->pool, sizeof(*info));
-      info->log_entry = svn_log_entry_create(parser->state->pool);
+      info = apr_pcalloc(info_pool, sizeof(*info));
+      info->pool = info_pool;
+      info->log_entry = svn_log_entry_create(info_pool);
 
-      info->pool = parser->state->pool;
       info->log_entry->revision = SVN_INVALID_REVNUM;
 
       parser->state->private = info;
@@ -220,11 +221,14 @@ start_log(svn_ra_serf__xml_parser_t *par
         }
       else if (strcmp(name.name, "revprop") == 0)
         {
+          const char *revprop_name;
           info = push_state(parser, log_ctx, REVPROP);
-          info->revprop_name = svn_xml_get_attr_value("name", attrs);
-          if (info->revprop_name == NULL)
+          revprop_name = svn_xml_get_attr_value("name", attrs);
+          if (revprop_name == NULL)
             return svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
                                      _("Missing name attr in revprop element"));
+
+          info->revprop_name = apr_pstrdup(info->pool, revprop_name);
         }
       else if (strcmp(name.name, "has-children") == 0)
         {
@@ -342,6 +346,7 @@ end_log(svn_ra_serf__xml_parser_t *parse
           log_ctx->nest_level--;
         }
 
+      svn_pool_destroy(info->pool);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == VERSION &&



Mime
View raw message