aboutsummaryrefslogtreecommitdiff
path: root/bfd/cofflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-05-20 17:25:20 +0930
committerAlan Modra <amodra@gmail.com>2020-05-21 10:11:57 +0930
commitc95949892f6f1e2974a0fb8a5463d7b6432ac469 (patch)
tree787ac00de8dc1bfb5170e2b2caf05e66d8ab6c7f /bfd/cofflink.c
parentc31ab5a0010ac9e3d31fd218fffcff1b9696363e (diff)
downloadgdb-c95949892f6f1e2974a0fb8a5463d7b6432ac469.zip
gdb-c95949892f6f1e2974a0fb8a5463d7b6432ac469.tar.gz
gdb-c95949892f6f1e2974a0fb8a5463d7b6432ac469.tar.bz2
Replace "if (x) free (x)" with "free (x)", bfd
* aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout. * archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c, * coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c, * cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c, * elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c, * elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c, * elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c, * elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c * elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h, * elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c, * mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c, * peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c, * targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
Diffstat (limited to 'bfd/cofflink.c')
-rw-r--r--bfd/cofflink.c98
1 files changed, 30 insertions, 68 deletions
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 0beff83..27ac20e 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -993,41 +993,20 @@ _bfd_coff_final_link (bfd *abfd,
coff_debug_merge_hash_table_free (&flaginfo.debug_merge);
debug_merge_allocated = FALSE;
- if (flaginfo.internal_syms != NULL)
- {
- free (flaginfo.internal_syms);
- flaginfo.internal_syms = NULL;
- }
- if (flaginfo.sec_ptrs != NULL)
- {
- free (flaginfo.sec_ptrs);
- flaginfo.sec_ptrs = NULL;
- }
- if (flaginfo.sym_indices != NULL)
- {
- free (flaginfo.sym_indices);
- flaginfo.sym_indices = NULL;
- }
- if (flaginfo.linenos != NULL)
- {
- free (flaginfo.linenos);
- flaginfo.linenos = NULL;
- }
- if (flaginfo.contents != NULL)
- {
- free (flaginfo.contents);
- flaginfo.contents = NULL;
- }
- if (flaginfo.external_relocs != NULL)
- {
- free (flaginfo.external_relocs);
- flaginfo.external_relocs = NULL;
- }
- if (flaginfo.internal_relocs != NULL)
- {
- free (flaginfo.internal_relocs);
- flaginfo.internal_relocs = NULL;
- }
+ free (flaginfo.internal_syms);
+ flaginfo.internal_syms = NULL;
+ free (flaginfo.sec_ptrs);
+ flaginfo.sec_ptrs = NULL;
+ free (flaginfo.sym_indices);
+ flaginfo.sym_indices = NULL;
+ free (flaginfo.linenos);
+ flaginfo.linenos = NULL;
+ free (flaginfo.contents);
+ flaginfo.contents = NULL;
+ free (flaginfo.external_relocs);
+ flaginfo.external_relocs = NULL;
+ free (flaginfo.internal_relocs);
+ flaginfo.internal_relocs = NULL;
/* The value of the last C_FILE symbol is supposed to be the symbol
index of the first external symbol. Write it out again if
@@ -1066,11 +1045,8 @@ _bfd_coff_final_link (bfd *abfd,
goto error_return;
/* The outsyms buffer is used by _bfd_coff_write_global_sym. */
- if (flaginfo.outsyms != NULL)
- {
- free (flaginfo.outsyms);
- flaginfo.outsyms = NULL;
- }
+ free (flaginfo.outsyms);
+ flaginfo.outsyms = NULL;
if (bfd_link_relocatable (info) && max_output_reloc_count > 0)
{
@@ -1141,10 +1117,8 @@ _bfd_coff_final_link (bfd *abfd,
for (i = 0; i < abfd->section_count; i++)
{
- if (flaginfo.section_info[i].relocs != NULL)
- free (flaginfo.section_info[i].relocs);
- if (flaginfo.section_info[i].rel_hashes != NULL)
- free (flaginfo.section_info[i].rel_hashes);
+ free (flaginfo.section_info[i].relocs);
+ free (flaginfo.section_info[i].rel_hashes);
}
free (flaginfo.section_info);
flaginfo.section_info = NULL;
@@ -1203,31 +1177,20 @@ _bfd_coff_final_link (bfd *abfd,
for (i = 0; i < abfd->section_count; i++)
{
- if (flaginfo.section_info[i].relocs != NULL)
- free (flaginfo.section_info[i].relocs);
- if (flaginfo.section_info[i].rel_hashes != NULL)
- free (flaginfo.section_info[i].rel_hashes);
+ free (flaginfo.section_info[i].relocs);
+ free (flaginfo.section_info[i].rel_hashes);
}
free (flaginfo.section_info);
}
- if (flaginfo.internal_syms != NULL)
- free (flaginfo.internal_syms);
- if (flaginfo.sec_ptrs != NULL)
- free (flaginfo.sec_ptrs);
- if (flaginfo.sym_indices != NULL)
- free (flaginfo.sym_indices);
- if (flaginfo.outsyms != NULL)
- free (flaginfo.outsyms);
- if (flaginfo.linenos != NULL)
- free (flaginfo.linenos);
- if (flaginfo.contents != NULL)
- free (flaginfo.contents);
- if (flaginfo.external_relocs != NULL)
- free (flaginfo.external_relocs);
- if (flaginfo.internal_relocs != NULL)
- free (flaginfo.internal_relocs);
- if (external_relocs != NULL)
- free (external_relocs);
+ free (flaginfo.internal_syms);
+ free (flaginfo.sec_ptrs);
+ free (flaginfo.sym_indices);
+ free (flaginfo.outsyms);
+ free (flaginfo.linenos);
+ free (flaginfo.contents);
+ free (flaginfo.external_relocs);
+ free (flaginfo.internal_relocs);
+ free (external_relocs);
return FALSE;
}
@@ -1286,8 +1249,7 @@ process_embedded_commands (bfd *output_bfd,
if (!bfd_malloc_and_get_section (abfd, sec, &copy))
{
- if (copy != NULL)
- free (copy);
+ free (copy);
return 0;
}
e = (char *) copy + sec->size;