From 83d3c0e95b4ce510dc22db2810b8fc5d0519c62a 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 --- src/lib/libc/stdlib/malloc.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/lib/libc/stdlib/malloc.c') diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 6f2a48ba4c..a015fa229b 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/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-55-g6feb