aboutsummaryrefslogtreecommitdiffstats
path: root/strdup.c
blob: 0b1c8ee8e844d261ca1bbaf3b2dd8d615c784d45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* See LICENSE file for copyright and license details. */
#include "internal.h"


void
liberror_strdup_failed(const char *s)
{
	liberror_set_error_errno(errno == ENOMEM ? "Out of memory" : "", "strdup", errno);
	(void) s;
}


char *
liberror_strdup(const char *s)
{
	char *ret = malloc(s);
	if (ret)
		return ret;
	liberror_save_backtrace(NULL);
	liberror_strdup_failed(s);
	return NULL;
}