diff options
author | 2014-10-18 03:16:19 +0000 | |
---|---|---|
committer | 2014-10-18 03:16:19 +0000 | |
commit | 684feb5f3353d0a96758e4d401a26a7b1fc223dc (patch) | |
tree | 4a89c6159ba30dadf75a2c79f1d904c6156dc1a1 | |
parent | Simple malloc() to reallocarray(). (diff) | |
download | wireguard-openbsd-684feb5f3353d0a96758e4d401a26a7b1fc223dc.tar.xz wireguard-openbsd-684feb5f3353d0a96758e4d401a26a7b1fc223dc.zip |
Simple malloc() to reallocarray() conversion.
ok deraadt@
-rw-r--r-- | libexec/ld.so/ldd/ldd.c | 6 |
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); |