Commit 82e6a42c by nulltoken

tree-cache: Zero out the allocated tree children array

parent 7b69289f
...@@ -138,6 +138,8 @@ static int read_tree_internal(git_tree_cache **out, ...@@ -138,6 +138,8 @@ static int read_tree_internal(git_tree_cache **out,
tree->children = git__malloc(tree->children_count * sizeof(git_tree_cache *)); tree->children = git__malloc(tree->children_count * sizeof(git_tree_cache *));
GITERR_CHECK_ALLOC(tree->children); GITERR_CHECK_ALLOC(tree->children);
memset(tree->children, 0x0, tree->children_count * sizeof(git_tree_cache *));
for (i = 0; i < tree->children_count; ++i) { for (i = 0; i < tree->children_count; ++i) {
if (read_tree_internal(&tree->children[i], &buffer, buffer_end, tree) < 0) if (read_tree_internal(&tree->children[i], &buffer, buffer_end, tree) < 0)
goto corrupted; goto corrupted;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment