aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-rs6000.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2014-02-04 20:17:16 +0100
committerJan Kratochvil <jan.kratochvil@redhat.com>2014-02-04 20:17:16 +0100
commit2915c55b41d00f12ed6bc54b4160e3367065c1c8 (patch)
treee14debda024e41d5fc7ec74415ae1304a747d7e5 /bfd/coff-rs6000.c
parent591a12a1d4c8843343eb999145d8bcc1efedf408 (diff)
downloadfsf-binutils-gdb-2915c55b41d00f12ed6bc54b4160e3367065c1c8.zip
fsf-binutils-gdb-2915c55b41d00f12ed6bc54b4160e3367065c1c8.tar.gz
fsf-binutils-gdb-2915c55b41d00f12ed6bc54b4160e3367065c1c8.tar.bz2
Fix PowerPC targets minor memory leaks found by Coverity
bfd/ 2014-02-04 Jan Kratochvil <jan.kratochvil@redhat.com> * coff-rs6000.c (xcoff_write_archive_contents_big): Free OFFSETS in return paths. Three times. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Free HTAB in all return paths. (ppc64_elf_tls_optimize): Free TOC_REF in return path. (ppc64_elf_edit_toc): Free USED in return path.
Diffstat (limited to 'bfd/coff-rs6000.c')
-rw-r--r--bfd/coff-rs6000.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 1170c7f..2b5f952 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -2404,7 +2404,10 @@ xcoff_write_archive_contents_big (bfd *abfd)
PRINT20 (ahdrp->nextoff, iterator.next.offset);
if (!do_pad (abfd, iterator.current.leading_padding))
- return FALSE;
+ {
+ free (offsets);
+ return FALSE;
+ }
BFD_ASSERT (iterator.current.offset == bfd_tell (abfd));
namlen = iterator.current.padded_namlen;
@@ -2414,7 +2417,10 @@ xcoff_write_archive_contents_big (bfd *abfd)
|| bfd_seek (iterator.current.member, 0, SEEK_SET) != 0
|| !do_copy (abfd, iterator.current.member)
|| !do_pad (abfd, iterator.current.trailing_padding))
- return FALSE;
+ {
+ free (offsets);
+ return FALSE;
+ }
offsets[i] = iterator.current.offset;
prevoff = iterator.current.offset;
@@ -2459,7 +2465,10 @@ xcoff_write_archive_contents_big (bfd *abfd)
member_table_size += member_table_size & 1;
member_table = bfd_zmalloc (member_table_size);
if (member_table == NULL)
- return FALSE;
+ {
+ free (offsets);
+ return FALSE;
+ }
hdr = (struct xcoff_ar_hdr_big *) member_table;