Commit 8ace41654bb59eb8a66495cd299537ea7e2456f3

Vicent Martí 2013-01-11T08:26:26

Merge pull request #1226 from nulltoken/fix/refspec_free refspec: prevent git_refspec__free() from segfaulting

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/refspec.c b/src/refspec.c
index 5567301..bd69f58 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -127,6 +127,9 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
 
 void git_refspec__free(git_refspec *refspec)
 {
+	if (refspec == NULL)
+		return;
+
 	git__free(refspec->src);
 	git__free(refspec->dst);
 }