This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix copy of filename in bfd's filename field
- From: Doug Evans <dje at google dot com>
- To: nick clifton <nickc at redhat dot com>
- Cc: Edjunior Barbosa Machado <emachado at linux dot vnet dot ibm dot com>, gdb-patches <gdb-patches at sourceware dot org>
- Date: Fri, 3 Jan 2014 09:53:29 -0800
- Subject: Re: [PATCH] Fix copy of filename in bfd's filename field
- Authentication-results: sourceware.org; auth=none
- References: <1388753936-2835-1-git-send-email-emachado at linux dot vnet dot ibm dot com> <52C6CAB2 dot 9020108 at redhat dot com>
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.