From 32c47a1a6b6bf5215146ca8a0254e30badb82d83 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 2 Aug 2010 20:57:36 +0200 Subject: [PATCH] When crashing of out-of-memory in x_*alloc, print wanted allocation size --- util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util.c b/util.c index 73ee41c44..a0c10766c 100644 --- a/util.c +++ b/util.c @@ -537,7 +537,7 @@ x_strndup(const char *s, size_t n) ret = strndup(s, n); #endif if (!ret) { - fatal("Out of memory in x_strndup"); + fatal("x_strndup: Could not allocate %lu bytes", (unsigned long)n); } return ret; } @@ -551,7 +551,7 @@ x_malloc(size_t size) void *ret; ret = malloc(size); if (!ret) { - fatal("Out of memory in x_malloc"); + fatal("x_malloc: Could not allocate %lu bytes", (unsigned long)size); } return ret; } @@ -566,7 +566,7 @@ x_realloc(void *ptr, size_t size) if (!ptr) return x_malloc(size); p2 = realloc(ptr, size); if (!p2) { - fatal("Out of memory in x_realloc"); + fatal("x_realloc: Could not allocate %lu bytes", (unsigned long)size); } return p2; } -- 2.47.3