refs: handle NULL pointers passed to git_reference_iterator_free() Signed-off-by: Brodie Rao <brodie@sf.io>
diff --git a/src/refs.c b/src/refs.c
index c8a833b..ce172aa 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -724,6 +724,9 @@ int git_reference_next_name(const char **out, git_reference_iterator *iter)
void git_reference_iterator_free(git_reference_iterator *iter)
{
+ if (iter == NULL)
+ return;
+
git_refdb_iterator_free(iter);
}