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/elf32-sh.c | |
parent | c31ab5a0010ac9e3d31fd218fffcff1b9696363e (diff) | |
download | fsf-binutils-gdb-c95949892f6f1e2974a0fb8a5463d7b6432ac469.zip fsf-binutils-gdb-c95949892f6f1e2974a0fb8a5463d7b6432ac469.tar.gz fsf-binutils-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/elf32-sh.c')
-rw-r--r-- | bfd/elf32-sh.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 24203e0..7daf851 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -167,8 +167,7 @@ sh_elf_reloc_loop (int r_type ATTRIBUTE_UNUSED, bfd *input_bfd, if (!bfd_malloc_and_get_section (input_bfd, symbol_section, &contents)) { - if (contents != NULL) - free (contents); + free (contents); return bfd_reloc_outofrange; } } @@ -203,8 +202,7 @@ sh_elf_reloc_loop (int r_type ATTRIBUTE_UNUSED, bfd *input_bfd, end = start0; } - if (contents != NULL - && elf_section_data (symbol_section)->this_hdr.contents != contents) + if (elf_section_data (symbol_section)->this_hdr.contents != contents) free (contents); insn = bfd_get_16 (input_bfd, contents + addr); @@ -811,21 +809,17 @@ sh_elf_relax_section (bfd *abfd, asection *sec, } } - if (internal_relocs != NULL - && elf_section_data (sec)->relocs != internal_relocs) + if (elf_section_data (sec)->relocs != internal_relocs) free (internal_relocs); return TRUE; error_return: - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) + if (symtab_hdr->contents != (unsigned char *) isymbuf) free (isymbuf); - if (contents != NULL - && elf_section_data (sec)->this_hdr.contents != contents) + if (elf_section_data (sec)->this_hdr.contents != contents) free (contents); - if (internal_relocs != NULL - && elf_section_data (sec)->relocs != internal_relocs) + if (elf_section_data (sec)->relocs != internal_relocs) free (internal_relocs); return FALSE; @@ -1195,8 +1189,7 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, when we leave sh_coff_relax_section. */ if (!bfd_malloc_and_get_section (abfd, o, &ocontents)) { - if (ocontents != NULL) - free (ocontents); + free (ocontents); return FALSE; } @@ -1253,8 +1246,7 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, when we leave sh_coff_relax_section. */ if (!bfd_malloc_and_get_section (abfd, o, &ocontents)) { - if (ocontents != NULL) - free (ocontents); + free (ocontents); return FALSE; } @@ -1387,8 +1379,7 @@ sh_elf_align_loads (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, return TRUE; error_return: - if (labels != NULL) - free (labels); + free (labels); return FALSE; } @@ -5257,10 +5248,8 @@ sh_elf_get_relocated_section_contents (bfd *output_bfd, isymbuf, sections)) goto error_return; - if (sections != NULL) - free (sections); - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) + free (sections); + if (symtab_hdr->contents != (unsigned char *) isymbuf) free (isymbuf); if (elf_section_data (input_section)->relocs != internal_relocs) free (internal_relocs); @@ -5269,13 +5258,10 @@ sh_elf_get_relocated_section_contents (bfd *output_bfd, return data; error_return: - if (sections != NULL) - free (sections); - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) + free (sections); + if (symtab_hdr->contents != (unsigned char *) isymbuf) free (isymbuf); - if (internal_relocs != NULL - && elf_section_data (input_section)->relocs != internal_relocs) + if (elf_section_data (input_section)->relocs != internal_relocs) free (internal_relocs); return NULL; } |