debugging: XMALLOC_POISON
Compile with -DXMALLOC_POISON=1 to catch errors from using uninitialized memory returned by xmalloc. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
7c49cb2881
commit
aa5481c1af
@ -91,6 +91,9 @@ static inline void *xmalloc(size_t size)
|
|||||||
ret = malloc(1);
|
ret = malloc(1);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
die("Out of memory, malloc failed");
|
die("Out of memory, malloc failed");
|
||||||
|
#ifdef XMALLOC_POISON
|
||||||
|
memset(ret, 0xA5, size);
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user