Re: [RFA] Replace strdup with xstrdup in tic30-dis.c

Andrew Cagney
2002-11-19T16:26:20Z

> On Mon, Nov 18, 2002 at 05:16:06PM -0500, Klee Dienes wrote:
>
>> * tic30-dis.c (print_par_insn): Use xstrdup instead of strdup.

Alan, to clarify something here.

I know BFD intentionally doesn't use the x*() functions. Instead it
tries to clean up and return an error indication when there is a
malloc() failure.

What of the disassembler though? GDB, which is depending on the
disassembler, needs to be able to recover from low memory (aka malloc()
failure) conditions. Is using xstrdup() in the disassembler going to
lead to memory leaks in the case where xmalloc() fails?

Andrew