diff options
author | Alan Modra <amodra@gmail.com> | 2020-05-20 17:25:20 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-05-21 10:11:57 +0930 |
commit | c95949892f6f1e2974a0fb8a5463d7b6432ac469 (patch) | |
tree | 787ac00de8dc1bfb5170e2b2caf05e66d8ab6c7f /bfd/som.c | |
parent | c31ab5a0010ac9e3d31fd218fffcff1b9696363e (diff) | |
download | gdb-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/som.c')
-rw-r--r-- | bfd/som.c | 84 |
1 files changed, 28 insertions, 56 deletions
@@ -2369,20 +2369,13 @@ setup_sections (bfd *abfd, for (i = 0; i < total_subspaces; i++) subspace_sections[i]->target_index = i; - if (space_strings != NULL) - free (space_strings); - - if (subspace_sections != NULL) - free (subspace_sections); - + free (space_strings); + free (subspace_sections); return TRUE; error_return: - if (space_strings != NULL) - free (space_strings); - - if (subspace_sections != NULL) - free (subspace_sections); + free (space_strings); + free (subspace_sections); return FALSE; } @@ -4528,12 +4521,11 @@ som_build_and_write_symbol_table (bfd *abfd) if (bfd_bwrite ((void *) som_symtab, symtab_size, abfd) != symtab_size) goto error_return; - if (som_symtab != NULL) - free (som_symtab); + free (som_symtab); return TRUE; + error_return: - if (som_symtab != NULL) - free (som_symtab); + free (som_symtab); return FALSE; } @@ -4827,15 +4819,12 @@ som_slurp_symbol_table (bfd *abfd) /* Save our results and return success. */ obj_som_symtab (abfd) = symbase; successful_return: - if (buf != NULL) - free (buf); + free (buf); return (TRUE); error_return: - if (symbase != NULL) - free (symbase); - if (buf != NULL) - free (buf); + free (symbase); + free (buf); return FALSE; } @@ -5230,8 +5219,7 @@ som_set_reloc_info (unsigned char *fixup, if (!bfd_malloc_and_get_section (section->owner, section, &contents)) { - if (contents != NULL) - free (contents); + free (contents); return (unsigned) -1; } section->contents = contents; @@ -5977,13 +5965,11 @@ som_bfd_count_ar_symbols (bfd *abfd, (*count)++; } } - if (hash_table != NULL) - free (hash_table); + free (hash_table); return TRUE; error_return: - if (hash_table != NULL) - free (hash_table); + free (hash_table); return FALSE; } @@ -6152,17 +6138,13 @@ som_bfd_fill_in_ar_symbols (bfd *abfd, } /* If we haven't died by now, then we successfully read the entire archive symbol table. */ - if (hash_table != NULL) - free (hash_table); - if (som_dict != NULL) - free (som_dict); + free (hash_table); + free (som_dict); return TRUE; error_return: - if (hash_table != NULL) - free (hash_table); - if (som_dict != NULL) - free (som_dict); + free (hash_table); + free (som_dict); return FALSE; } @@ -6611,29 +6593,19 @@ som_bfd_ar_write_symbol_stuff (bfd *abfd, if (bfd_bwrite ((void *) strings, amt, abfd) != amt) goto error_return; - if (hash_table != NULL) - free (hash_table); - if (som_dict != NULL) - free (som_dict); - if (last_hash_entry != NULL) - free (last_hash_entry); - if (lst_syms != NULL) - free (lst_syms); - if (strings != NULL) - free (strings); + free (hash_table); + free (som_dict); + free (last_hash_entry); + free (lst_syms); + free (strings); return TRUE; error_return: - if (hash_table != NULL) - free (hash_table); - if (som_dict != NULL) - free (som_dict); - if (last_hash_entry != NULL) - free (last_hash_entry); - if (lst_syms != NULL) - free (lst_syms); - if (strings != NULL) - free (strings); + free (hash_table); + free (som_dict); + free (last_hash_entry); + free (lst_syms); + free (strings); return FALSE; } @@ -6785,7 +6757,7 @@ som_bfd_free_cached_info (bfd *abfd) { asection *o; -#define FREE(x) if (x != NULL) { free (x); x = NULL; } +#define FREE(x) do { free (x); x = NULL; } while (0) /* Free the native string and symbol tables. */ FREE (obj_som_symtab (abfd)); FREE (obj_som_stringtab (abfd)); |