Commit 9eb45fc51a55fb8b058a28b5ee1e297991fedca5

Brodie Rao 2014-01-12T23:29:44

branch: handle NULL pointers passed to git_branch_iterator_free() Signed-off-by: Brodie Rao <brodie@sf.io>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/branch.c b/src/branch.c
index ef71c2c..9ed0add 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -181,6 +181,9 @@ void git_branch_iterator_free(git_branch_iterator *_iter)
 {
 	branch_iter *iter = (branch_iter *) _iter;
 
+	if (iter == NULL)
+		return;
+
 	git_reference_iterator_free(iter->iter);
 	git__free(iter);
 }