aboutsummaryrefslogtreecommitdiffstats
path: root/mem.c
blob: baa7977ecfbab2fa25431ba371052633d555fde9 (plain) (blame)
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
#include "mem.h"

#include <curses.h>
#include <stddef.h>
#include <stdlib.h>

#include "err.h"

void *xmalloc(size_t size)
{
	void *rtn = malloc(size);
	if (!rtn) {
		die("Out of memory");
	}
	return rtn;
}

void *xrealloc(void *p, size_t size)
{
	void *pmem = realloc(p, size);

	if (!pmem)
		free(p);

	return pmem;
}