summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/malloc.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-04-22 14:26:26 +0000
committertedu <tedu@openbsd.org>2014-04-22 14:26:26 +0000
commit7e25e286a3f6dc6f10ce96311881490e384fdb24 (patch)
tree8e233acd818f3712a38cd3326a942b210971c5c9 /lib/libc/stdlib/malloc.c
parentKNF. (diff)
downloadwireguard-openbsd-7e25e286a3f6dc6f10ce96311881490e384fdb24.tar.xz
wireguard-openbsd-7e25e286a3f6dc6f10ce96311881490e384fdb24.zip
change mallocarray to reallocarray. useful in a few more situations.
malloc can, as always, be emulated via realloc(NULL). ok deraadt
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r--lib/libc/stdlib/malloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index b48dcb39789..5790781733f 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.154 2014/04/21 13:17:32 deraadt Exp $ */
+/* $OpenBSD: malloc.c,v 1.155 2014/04/22 14:26:26 tedu Exp $ */
/*
* Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -1433,14 +1433,14 @@ calloc(size_t nmemb, size_t size)
}
void *
-mallocarray(size_t nmemb, size_t size)
+reallocarray(void *optr, size_t nmemb, size_t size)
{
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
nmemb > 0 && SIZE_MAX / nmemb < size) {
errno = ENOMEM;
return NULL;
}
- return malloc(size * nmemb);
+ return realloc(optr, size * nmemb);
}
static void *