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

Andrew Cagney ac131313@redhat.com
Tue Nov 19 08:26:00 GMT 2002


> 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




More information about the Gdb mailing list