Commit 2ad45213a84a5e3948557edcb3a76bc439f8b61e

Brodie Rao 2014-01-12T23:31:57

refs: handle NULL pointers passed to git_reference_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/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);
 }