This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [committed, PATCH] Free memory returned from bfd_get_synthetic_symtab
On Mon, Sep 25, 2017 at 04:27:18PM -0700, H.J. Lu wrote:
> On 9/25/17, Andreas Schwab <schwab@linux-m68k.org> wrote:
> > On Sep 25 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:
> >
> >> @@ -1201,6 +1201,8 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
> >> else
> >> print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd);
> >>
> >> + if (synthsyms)
> >> + free (synthsyms);
> >
> > There is no need to check for NULL.
> >
>
> Are we assuming "free (NULL)" always works?
I think we can nowadays, but even knowing that I still often add the
NULL check. Old habits die hard.
--
Alan Modra
Australia Development Lab, IBM