]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
When crashing of out-of-memory in x_*alloc, print wanted allocation size
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 2 Aug 2010 18:57:36 +0000 (20:57 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 2 Aug 2010 18:57:36 +0000 (20:57 +0200)
util.c

diff --git a/util.c b/util.c
index 73ee41c4491be4b04a91d502ca005a9642503ff0..a0c10766c004c541daaa54a863283d297ff0c5fb 100644 (file)
--- 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;
 }