Commit 8f12d136c9fb21617f752fb3f8a78c735dd97437

Russell Belfer 2012-05-14T09:37:13

Merge pull request #695 from nulltoken/topic/iterator_free_null_tolerant iterator: prevent git_iterator_free() from segfaulting when being passed a NULL iterator

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/iterator.h b/src/iterator.h
index 12eb96b..974c2da 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -71,6 +71,9 @@ GIT_INLINE(int) git_iterator_reset(git_iterator *iter)
 
 GIT_INLINE(void) git_iterator_free(git_iterator *iter)
 {
+	if (iter == NULL)
+		return;
+
 	iter->free(iter);
 	git__free(iter);
 }