diff options
author | 2014-05-08 21:43:49 +0000 | |
---|---|---|
committer | 2014-05-08 21:43:49 +0000 | |
commit | 91c2a70715ef3ba4fe719d27609670f8fca87f6b (patch) | |
tree | 256e064794b1cce03b9bb28b714746f0eafb28ad /lib/libc/stdlib/malloc.c | |
parent | Format string fixes and removal of -Wno-format for landisk kernels (diff) | |
download | wireguard-openbsd-91c2a70715ef3ba4fe719d27609670f8fca87f6b.tar.xz wireguard-openbsd-91c2a70715ef3ba4fe719d27609670f8fca87f6b.zip |
move reallocarray() to a seperate file so that -portable applications
can avoid reinventing the wheel
ok guenther schwarze
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 6f2a48ba4c5..a015fa229b5 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.160 2014/05/07 20:07:59 halex Exp $ */ +/* $OpenBSD: malloc.c,v 1.161 2014/05/08 21:43:49 deraadt Exp $ */ /* * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> @@ -1424,17 +1424,6 @@ calloc(size_t nmemb, size_t size) return r; } -void * -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 realloc(optr, size * nmemb); -} - static void * mapalign(struct dir_info *d, size_t alignment, size_t sz, int zero_fill) { |