Commit 1c3edb307842dede8d20cecc734359b68c67fd65

nulltoken 2012-07-12T09:46:45

tree: prevent git_tree_entry_free() from segfaulting when being passed a NULL tree_entry

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/tree.c b/src/tree.c
index b609eea..4d22f2f 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -140,6 +140,9 @@ static int tree_key_search(git_vector *entries, const char *filename, size_t fil
 
 void git_tree_entry_free(git_tree_entry *entry)
 {
+	if (entry == NULL)
+		return;
+
 	git__free(entry);
 }