aboutsummaryrefslogtreecommitdiffstats
path: root/malloc.c
blob: 4d4057296d5ac5787e9714208525cc8adc917583 (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
/* See LICENSE file for copyright and license details. */
#include "internal.h"


void
liberror_malloc_failed(size_t n)
{
	liberror_set_error_errno("Out of memory", "malloc", ENOMEM);
	errno = ENOMEM;
	(void) n;
}


void *
liberror_malloc(size_t n)
{
	void *ret = malloc(n);
	if (ret || !n)
		return ret;
	liberror_save_backtrace(NULL);
	liberror_malloc_failed(n);
	return NULL;
}