summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorStefan Kempf <stefan@cvs.openbsd.org>2016-08-01 16:40:10 +0000
committerStefan Kempf <stefan@cvs.openbsd.org>2016-08-01 16:40:10 +0000
commitb80f393bdeb92ef8fbbd8c47bfd6b00c9a00c613 (patch)
tree4a7f6adcaebb8ea4193a9d93ffd356613df4db56 /gnu
parenta6a1e0b27824199927ede39105f4cf40736c226f (diff)
Make sure variables are initialized before using them
In elf.c, do not increment `s' before it is initialized. At the time of the increment, `s' is otherwise unused anyway. In elflink.c, initialize sec_contents and l_sec_contents to make sure that the free(sec_contents) and free(l_sec_contents) are called on valid pointers. ok jca@ guenther@
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/binutils-2.17/bfd/elf.c2
-rw-r--r--gnu/usr.bin/binutils-2.17/bfd/elflink.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/gnu/usr.bin/binutils-2.17/bfd/elf.c b/gnu/usr.bin/binutils-2.17/bfd/elf.c
index 2e874b8d166..c74b8503da9 100644
--- a/gnu/usr.bin/binutils-2.17/bfd/elf.c
+++ b/gnu/usr.bin/binutils-2.17/bfd/elf.c
@@ -8617,7 +8617,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
count = relplt->size / hdr->sh_entsize;
size = count * sizeof (asymbol);
p = relplt->relocation;
- for (i = 0; i < count; i++, s++, p++)
+ for (i = 0; i < count; i++, p++)
size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
s = *ret = bfd_malloc (size);
diff --git a/gnu/usr.bin/binutils-2.17/bfd/elflink.c b/gnu/usr.bin/binutils-2.17/bfd/elflink.c
index baa6e590148..2673b408a18 100644
--- a/gnu/usr.bin/binutils-2.17/bfd/elflink.c
+++ b/gnu/usr.bin/binutils-2.17/bfd/elflink.c
@@ -9862,7 +9862,7 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *sec,
abfd, sec);
else if (sec->size != 0)
{
- bfd_byte *sec_contents, *l_sec_contents;
+ bfd_byte *sec_contents = NULL, *l_sec_contents = NULL;
if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
(*_bfd_error_handler)