summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-08 19:23:47 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-08-08 19:24:13 (GMT)
commitaa5481c1af08edbca821a0d025d26e9bc41a5c49 (patch)
tree285a6b86946e39b154bf83220ee46d7f9addc9fc /git-compat-util.h
parent7c49cb288173ab5264b3b9e4257aeeb13388334c (diff)
downloadgit-aa5481c1af08edbca821a0d025d26e9bc41a5c49.zip
git-aa5481c1af08edbca821a0d025d26e9bc41a5c49.tar.gz
git-aa5481c1af08edbca821a0d025d26e9bc41a5c49.tar.bz2
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>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 93f5580..3bcf5b1 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;
}