Commit 7b69289f4e9249f61fb48593ddbf66b6f9ad6494

nulltoken 2013-11-19T12:54:57

tree-cache: Free the tree upon the detection of a corrupted child

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 97ffc2a..d176282 100644
--- a/src/tree-cache.c
+++ b/src/tree-cache.c
@@ -140,7 +140,7 @@ static int read_tree_internal(git_tree_cache **out,
 
 		for (i = 0; i < tree->children_count; ++i) {
 			if (read_tree_internal(&tree->children[i], &buffer, buffer_end, tree) < 0)
-				return -1;
+				goto corrupted;
 		}
 	}