diff options
Diffstat (limited to 'malloc.c')
-rw-r--r-- | malloc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/malloc.c b/malloc.c new file mode 100644 index 0000000..4d40572 --- /dev/null +++ b/malloc.c @@ -0,0 +1,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; +} |