Commit 82e6a42c6c387a584df1b2efb4fa3bfdb8c290a2

nulltoken 2013-11-19T13:13:51

tree-cache: Zero out the allocated tree children array

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/tree-cache.c b/src/tree-cache.c
index d176282..a693f4f 100644
--- a/src/tree-cache.c
+++ b/src/tree-cache.c
@@ -138,6 +138,8 @@ static int read_tree_internal(git_tree_cache **out,
 		tree->children = git__malloc(tree->children_count * sizeof(git_tree_cache *));
 		GITERR_CHECK_ALLOC(tree->children);
 
+		memset(tree->children, 0x0, tree->children_count * sizeof(git_tree_cache *));
+
 		for (i = 0; i < tree->children_count; ++i) {
 			if (read_tree_internal(&tree->children[i], &buffer, buffer_end, tree) < 0)
 				goto corrupted;