[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r36202 - trunk/subversion/libsvn_ra_serf

From: Ivan Zhakov <ivan_at_visualsvn.com>
Date: Sat, 28 Feb 2009 01:49:22 +0300

On Sat, Feb 28, 2009 at 1:16 AM, Bert Huijben <bert_at_vmoo.com> wrote:
>> -----Original Message-----
>> From: Ivan Zhakov [mailto:ivan_at_visualsvn.com]
>> Sent: Friday, February 27, 2009 11:04 PM
>> To: dev_at_subversion.tigris.org; rhuijben_at_sharpsvn.net
>> Subject: Re: svn commit: r36202 - trunk/subversion/libsvn_ra_serf
>>
>> On Sat, Feb 28, 2009 at 12:50 AM, Bert Huijben <rhuijben_at_sharpsvn.net>
>> wrote:
>> > @@ -280,7 +281,7 @@ handle_checkout(serf_request_t *request,
>> >         }
>> >       apr_uri_parse(pool, location, &uri);
>
> This allocates uri in pool.
>
>> >
>> > -      ctx->resource_url = apr_pstrdup(ctx->pool, uri.path);
>> > +      ctx->resource_url = svn_uri_canonicalize(uri.path, ctx->pool);
>> >     }
>> You introduce memory management error here, because
>> svn_uri_canonicalize() does not guarantee that passed uri will be
>> copied to pool. See include\svn_direent_uri.h:323
>> [[[
>>  * The returned uri may be statically allocated, equal to @a uri, or
>>  * allocated from @a pool.
>> ]]]
>
> As uri is also allocated in pool, this can't create lifetime issues.
But uri should by allocated in ctx->pool instead of pool passed to
handle_checkout() that's why apr_pstrdup() used before to copy uri to
ctx->pool.

-- 
Ivan Zhakov
VisualSVN Team
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1241280
Received on 2009-02-27 23:49:39 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.