Commit 2fcc0d07d050a6d70d85c510cef7aea4845e340f

Brodie Rao 2014-01-12T23:32:10

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/util.c b/src/util.c
index 81a64c7..f977a9b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -140,6 +140,10 @@ int git_libgit2_opts(int key, ...)
 void git_strarray_free(git_strarray *array)
 {
 	size_t i;
+
+	if (array == NULL)
+		return;
+
 	for (i = 0; i < array->count; ++i)
 		git__free(array->strings[i]);