This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [RFA] Replace strdup with xstrdup in tic30-dis.c
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Andrew Cagney <ac131313 at redhat dot com>
- Cc: binutils at sources dot redhat dot com, gdb at sources dot redhat dot com
- Date: Thu, 21 Nov 2002 09:38:47 +1030
- Subject: Re: [RFA] Replace strdup with xstrdup in tic30-dis.c
- References: <E3F5CE00-FC28-11D6-8F9D-00039396EEB8@apple.com> <3DDBB2BA.90601@redhat.com>
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