aboutsummaryrefslogtreecommitdiffstats
path: root/realloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'realloc.c')
-rw-r--r--realloc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/realloc.c b/realloc.c
new file mode 100644
index 0000000..a029221
--- /dev/null
+++ b/realloc.c
@@ -0,0 +1,24 @@
+/* See LICENSE file for copyright and license details. */
+#include "internal.h"
+
+
+void
+liberror_realloc_failed(void *ptr, size_t n)
+{
+ liberror_set_error_errno("Out of memory", "realloc", ENOMEM);
+ errno = ENOMEM;
+ (void) ptr;
+ (void) n;
+}
+
+
+void *
+liberror_realloc(void *ptr, size_t n)
+{
+ void *ret = realloc(ptr, n);
+ if (ret || !n)
+ return ret;
+ liberror_save_backtrace(NULL);
+ liberror_realloc_failed(ptr, n);
+ return NULL;
+}