aboutsummaryrefslogtreecommitdiffstats
path: root/memory/reallocarray.c
blob: 8148b20a870ddf70a858075af2964eeae7403284 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#include "memory.h"
#include <errno.h>
#include <stdint.h>

void *reallocarray(void *buffer, size_t count, size_t size)
{
	if (count > 0 && SIZE_MAX / count < size) {
		errno = ENOMEM;
		return NULL;
	}
	return _realloc_wrap(buffer, count * size);
}