summaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2010-08-20 15:09:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-20 16:27:38 (GMT)
commit8bd9fd50014424643bddfde51423d42e0fc60800 (patch)
tree4cc964ddad37e45e53aac7a69e012bb5d22fb5d3 /wrapper.c
parent8c67c392e1620fc3b749aa9e0b8da13bd84226f8 (diff)
downloadgit-8bd9fd50014424643bddfde51423d42e0fc60800.zip
git-8bd9fd50014424643bddfde51423d42e0fc60800.tar.gz
git-8bd9fd50014424643bddfde51423d42e0fc60800.tar.bz2
xmalloc: include size in the failure message
Out-of-memory errors can either be actual lack of memory, or bugs (like code trying to call xmalloc(-1) by mistake). A little more information may help tracking bugs reported by users. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/wrapper.c b/wrapper.c
index afb4f6f..fd8ead3 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -40,7 +40,8 @@ void *xmalloc(size_t size)
if (!ret && !size)
ret = malloc(1);
if (!ret)
- die("Out of memory, malloc failed");
+ die("Out of memory, malloc failed (tried to allocate %lu bytes)",
+ (unsigned long)size);
}
#ifdef XMALLOC_POISON
memset(ret, 0xA5, size);