Commit 63170bcae91e5ddf6c0a2589d7212e0e62c8b269

Arthur Schreiber 2014-01-13T17:51:08

Fix a memory leak in `git_pathspec__vinit`.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/pathspec.c b/src/pathspec.c
index bad8dac..d6ce09c 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -89,8 +89,10 @@ int git_pathspec__vinit(
 		if (ret == GIT_ENOTFOUND) {
 			git__free(match);
 			continue;
-		} else if (ret < 0)
+		} else if (ret < 0) {
+			git__free(match);
 			return ret;
+		}
 
 		if (git_vector_insert(vspec, match) < 0)
 			return -1;