[PATCH v3 REVIEW 06/33] binutils: readelf: when dumping CTF, load strtab and symtab automatically
Alan Modra
amodra@gmail.com
Sun Sep 8 23:40:00 GMT 2019
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
More information about the Binutils
mailing list