aboutsummaryrefslogtreecommitdiff
path: root/src/libsunrpc/emalloc.c
blob: 8a09eda784e8721b5ab26b24b0ce0972e87fc5e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <sunrpc.h>

void*
emalloc(ulong n)
{
	void *v;

	v = mallocz(n, 1);
	if(v == nil)
{
abort();
		sysfatal("out of memory");
}
	setmalloctag(v, getcallerpc(&n));
	return v;
}

void*
erealloc(void *v, ulong n)
{
	v = realloc(v, n);
	if(v == nil)
{
abort();
		sysfatal("out of memory");
}
	setrealloctag(v, getcallerpc(&n));
	return v;
}