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>
Junio C Hamano committed
Aug 8, 2006 at 12:23 UTC
aa5481c1af08edbca821a0d025d26e9bc41a5c49
1 file changed
+3
git-compat-util.h
+3
@@ -91,6 +91,9 @@ static inline void *xmalloc(size_t size)
91
ret = malloc(1);
92
if (!ret)
93
die("Out of memory, malloc failed");
94
+#ifdef XMALLOC_POISON
95
+ memset(ret, 0xA5, size);
96
+#endif
97
return ret;
98
}
99