Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2FE536414 for ; Wed, 20 Jul 2011 00:40:35 +0000 (UTC) Received: (qmail 4363 invoked by uid 500); 20 Jul 2011 00:40:35 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 4300 invoked by uid 500); 20 Jul 2011 00:40:34 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 4293 invoked by uid 99); 20 Jul 2011 00:40:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jul 2011 00:40:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jul 2011 00:40:33 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2E5BC2388897 for ; Wed, 20 Jul 2011 00:40:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1148588 - /subversion/trunk/subversion/libsvn_ra_serf/log.c Date: Wed, 20 Jul 2011 00:40:13 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110720004013.2E5BC2388897@eris.apache.org> 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 &&