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

Alan Modra
2002-11-20T23:09:02Z

On Wed, Nov 20, 2002 at 11:05:14AM -0500, Andrew Cagney wrote:
> Problem is, a malloc() -> xmalloc() transformation also sweeps the
> problem under the carpet. The code no longer dumps core so it must be
> fixed, right?

Bombing with "out of memory" is nearly as bad.

> Accepting a work around involves a trade off. I think here, an implicit
> decision has already made: the disassembler shall use xmalloc(); the
> disassembler shall leak memory.

The disassembler doesn't need to leak memory. Hmm, I suppose it could
be difficult to free things that aren't exposed to the interface. You'd
rather bfd_alloc, which is freed automagically on bfd_close, eh?

> >I'm not arguing against a "no xmalloc in new code" rule, just that an
> >unchecked xmalloc is better than an unchecked malloc.
>
> Which reminds me, how is the elimination of true/false from "bfd.h" going?

Has that become my job?? ;)

--
Alan Modra
IBM OzLabs - Linux Technology Centre