From aa5481c1af08edbca821a0d025d26e9bc41a5c49 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <junkio@cox.net>
Date: Tue, 8 Aug 2006 12:23:47 -0700
Subject: [PATCH] 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>
---
 git-compat-util.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/git-compat-util.h b/git-compat-util.h
index 93f558056d..3bcf5b13f2 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -91,6 +91,9 @@ static inline void *xmalloc(size_t size)
 		ret = malloc(1);
 	if (!ret)
 		die("Out of memory, malloc failed");
+#ifdef XMALLOC_POISON
+	memset(ret, 0xA5, size);
+#endif
 	return ret;
 }