This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix copy of filename in bfd's filename field


Hi Nick,

On Fri, Jan 3, 2014 at 6:35 AM, nick clifton <nickc@redhat.com> wrote:
> Hi Edjunior,
>
>
>
>> gdb/
>> 2014-01-03  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
>>
>>         * gdb_bfd.c (gdb_bfd_stash_filename): Fix copy of filename in
>> bfd's
>>         filename field using xstrdup.
>
>
>
>> @@ -69,7 +69,7 @@ gdb_bfd_stash_filename (struct bfd *abfd)
>>     strcpy (data, name);
>>
>>     /* Unwarranted chumminess with BFD.  */
>> -  abfd->filename = data;
>> +  abfd->filename = xstrdup (data);
>>   }
>>
>>   /* An object of this type is stored in each BFD's user data.  */
>
>
> It might be nice to remove the comment too. :-)
>
> Cheers
>   Nick

Seems like bfd should export an API routine that sets abfd->filename,
so that the implementation detail that it lives in malloc space is
kept within bfd.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]