This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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 v3 REVIEW 06/33] binutils: readelf: when dumping CTF, load strtab and symtab automatically


On Fri, Sep 06, 2019 at 11:54:53PM +0100, Nick Alcock wrote:
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -13944,7 +13944,13 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
>    data = get_section_contents (section, filedata);
>    ctfsect.cts_data = data;
>  
> -  if (dump_ctf_symtab_name)
> +  if (!dump_ctf_symtab_name)
> +    dump_ctf_symtab_name = strdup (".symtab");

Please use xstrdup here and elsewhere, fixing the other uses of strdup
you added in a previous patch.

Note that the alternative of testing the result and printing an error
message is more suited to library code where you want to leave the
application some means of recovery.

-- 
Alan Modra
Australia Development Lab, IBM


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