From 91c2a70715ef3ba4fe719d27609670f8fca87f6b Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 8 May 2014 21:43:49 +0000 Subject: move reallocarray() to a seperate file so that -portable applications can avoid reinventing the wheel ok guenther schwarze --- lib/libc/stdlib/malloc.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'lib/libc/stdlib/malloc.c') 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 * Copyright (c) 2012 Matthew Dempsky @@ -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) { -- cgit v1.2.3-59-g8ed1b