branch: handle NULL pointers passed to git_branch_iterator_free() Signed-off-by: Brodie Rao <brodie@sf.io>
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);
}