summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2014-10-18 03:16:20 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2014-10-18 03:16:20 +0000
commit7e8e8745207120bbd4df0d913f758994c1e09475 (patch)
treefd798fab1ee164875be837c2e3f32d98a3760a1e /libexec
parenta0b8318edb676d4f06943c1357a9e69f754cb349 (diff)
Simple malloc() to reallocarray() conversion.
ok deraadt@
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/ldd/ldd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/ld.so/ldd/ldd.c b/libexec/ld.so/ldd/ldd.c
index a682ea01e3b..f68237160b5 100644
--- a/libexec/ld.so/ldd/ldd.c
+++ b/libexec/ld.so/ldd/ldd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldd.c,v 1.16 2013/07/14 14:36:41 jca Exp $ */
+/* $OpenBSD: ldd.c,v 1.17 2014/10/18 03:16:19 doug Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -116,9 +116,9 @@ doit(char *name)
return 1;
}
+ if ((phdr = reallocarray(NULL, ehdr.e_phnum, sizeof(Elf_Phdr))) == NULL)
+ err(1, "reallocarray");
size = ehdr.e_phnum * sizeof(Elf_Phdr);
- if ((phdr = malloc(size)) == NULL)
- err(1, "malloc");
if (pread(fd, phdr, size, ehdr.e_phoff) != size) {
warn("read(%s)", name);