summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-08 12:23:47 -0700
committerJunio C Hamano <junkio@cox.net>2006-08-08 12:24:13 -0700
commitaa5481c1af08edbca821a0d025d26e9bc41a5c49 (patch)
tree285a6b86946e39b154bf83220ee46d7f9addc9fc /git-compat-util.h
parent7c49cb288173ab5264b3b9e4257aeeb13388334c (diff)
downloadgit-aa5481c1af08edbca821a0d025d26e9bc41a5c49.tar.gz
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 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;
}