stab nearest_line bfd_malloc_and_get_section
authorAlan Modra <amodra@gmail.com>
Sat, 24 Sep 2022 08:44:14 +0000 (18:14 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 26 Sep 2022 04:53:29 +0000 (14:23 +0930)
commitf3bc603561c993cdb8811c361ec5e9e484628cdc
treea9f086c40f78834907e209df7bb55700a27455ae
parent544c5619574318a6f9044c6aace524a9808ed1d6
stab nearest_line bfd_malloc_and_get_section

bfd_malloc_and_get_section performs some sanity checks on the section
size before allocating memory.  This patch avails the stab
nearest_line code of that sanity checking, and tidies up memory
afterward.

* coffgen.c (_bfd_coff_close_and_cleanup): Call _bfd_stab_cleanup.
* elf.c (_bfd_elf_close_and_cleanup): Likewise.
* syms.c (_bfd_stab_section_find_nearest_line): Set *pinfo earlier.
Use bfd_malloc_and_get_section.  Free malloc'd buffers on failure.
Malloc indextable.
(_bfd_stab_cleanup): New function.
* libbfd-in.h (_bfd_stab_cleanup): Declare.
* libbfd.h: Regnerate.
bfd/coffgen.c
bfd/elf.c
bfd/libbfd-in.h
bfd/libbfd.h
bfd/syms.c