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

Re: [PATCH] Fix svn_log_changed_path_dup()

From: Madan U Sreenivasan <madan_at_collab.net>
Date: 2006-05-30 17:24:59 CEST

On Tue, 30 May 2006 20:00:45 +0530, C. Michael Pilato
<cmpilato@collab.net> wrote:

> Madan U Sreenivasan wrote:
>
>> === subversion/libsvn_subr/constructors.c
>> ==================================================================
>> --- subversion/libsvn_subr/constructors.c (revision 600)
>> +++ subversion/libsvn_subr/constructors.c (local)
>> @@ -60,12 +60,16 @@
>> svn_log_changed_path_t *new_changed_path
>> = apr_palloc(pool, sizeof(*new_changed_path));
>>
>> + /* Copy action */
>> *new_changed_path = *changed_path;
>>
>> - if (new_changed_path->copyfrom_path)
>> - new_changed_path->copyfrom_path =
>> - apr_pstrdup(pool, new_changed_path->copyfrom_path);
>> + /* Copy the copyfrom_path member variable */
>> + new_changed_path->copyfrom_path =
>> + apr_pstrdup(pool, changed_path->copyfrom_path);
>
> apr_pstrdup() will SEGFAULT if you try to copy a NULL value.
> changed_path->copyfrom_path must be NULL if
> new_changed_path->copyfrom_path
> was NULL due to the structure copy that precedes it (see below about
> that).

I paritally agree on the structure copy point. If a structure copy
happens, all the changes suggested by my patch are unnecessary.

But I'm not sure if all C compilers see *i = *p as a structure copy... I
was under the impression that this behavior was guaranteed for all
C++ compilers though.

Regards,
Madan.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue May 30 16:55:02 2006

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