summaryrefslogtreecommitdiffstats
path: root/common/calloc.c
blob: 2b933ec272b04b930699fb0086d54c90851ec755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <common.h>
#include <malloc.h>

/*
 * calloc calls malloc, then zeroes out the allocated chunk.
 */
void *calloc(size_t n, size_t elem_size)
{
	size_t size = elem_size * n;
	void *r = malloc(size);

	if (!r)
		return r;

	memset(r, 0x0, size);

	return r;
}
EXPORT_SYMBOL(calloc);