From: Matthieu Moy Date: Fri, 20 Aug 2010 15:09:51 +0000 (+0200) Subject: xmalloc: include size in the failure message X-Git-Tag: v1.7.2.3~26 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8bd9fd50014424643bddfde51423d42e0fc60800;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/wrapper.c b/wrapper.c index afb4f6f77..fd8ead33e 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);