summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstefan <stefan@openbsd.org>2016-08-01 16:40:09 +0000
committerstefan <stefan@openbsd.org>2016-08-01 16:40:09 +0000
commit52e389ba0d1de9131f6be288cfaf9b28a0b732e5 (patch)
treecf97ac53abb1919a114bea93d5d9581a73f2b35d
parentDo not pass VM name directly to setproctitle format string. (diff)
downloadwireguard-openbsd-52e389ba0d1de9131f6be288cfaf9b28a0b732e5.tar.xz
wireguard-openbsd-52e389ba0d1de9131f6be288cfaf9b28a0b732e5.zip
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@
-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)