aboutsummaryrefslogtreecommitdiff
path: root/bfd/srec.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/srec.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/srec.c')
-rw-r--r--bfd/srec.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/bfd/srec.c b/bfd/srec.c
index 1b3ead8..ef7eb43 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -493,8 +493,7 @@ srec_scan (bfd *abfd)
if (bytes * 2 > bufsize)
{
- if (buf != NULL)
- free (buf);
+ free (buf);
buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
if (buf == NULL)
goto error_return;
@@ -618,9 +617,7 @@ srec_scan (bfd *abfd)
goto error_return;
}
- if (buf != NULL)
- free (buf);
-
+ free (buf);
return TRUE;
}
}
@@ -631,16 +628,12 @@ srec_scan (bfd *abfd)
if (error)
goto error_return;
- if (buf != NULL)
- free (buf);
-
+ free (buf);
return TRUE;
error_return:
- if (symbuf != NULL)
- free (symbuf);
- if (buf != NULL)
- free (buf);
+ free (symbuf);
+ free (buf);
return FALSE;
}
@@ -751,8 +744,7 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
if (bytes * 2 > bufsize)
{
- if (buf != NULL)
- free (buf);
+ free (buf);
buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
if (buf == NULL)
goto error_return;
@@ -768,8 +760,7 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
{
default:
BFD_ASSERT (sofar == section->size);
- if (buf != NULL)
- free (buf);
+ free (buf);
return TRUE;
case '3':
@@ -793,8 +784,7 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
{
/* We've come to the end of this section. */
BFD_ASSERT (sofar == section->size);
- if (buf != NULL)
- free (buf);
+ free (buf);
return TRUE;
}
@@ -817,14 +807,11 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
BFD_ASSERT (sofar == section->size);
- if (buf != NULL)
- free (buf);
-
+ free (buf);
return TRUE;
error_return:
- if (buf != NULL)
- free (buf);
+ free (buf);
return FALSE;
}