From: Joel Rosdahl Date: Mon, 2 Aug 2010 18:57:36 +0000 (+0200) Subject: When crashing of out-of-memory in x_*alloc, print wanted allocation size X-Git-Tag: v3.1~108 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32c47a1a6b6bf5215146ca8a0254e30badb82d83;p=thirdparty%2Fccache.git When crashing of out-of-memory in x_*alloc, print wanted allocation size --- 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; }