summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Germishuys <jacquesg@striata.com>2015-01-25 14:38:10 +0200
committerJacques Germishuys <jacquesg@striata.com>2015-01-25 14:38:10 +0200
commit636af2198e7d9128d6bf49cd7f7119de62fd5975 (patch)
tree5e4602cd3dee4ccf15de753b16796d48478cb155
parentb63b3b0e4df81174a323ff6b1b4450014502e9b7 (diff)
downloadlibgit2-636af2198e7d9128d6bf49cd7f7119de62fd5975.tar.gz
Return early if allocating a git_pathspec_match_list failed
-rw-r--r--src/pathspec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pathspec.c b/src/pathspec.c
index 8b469f717..97b5d94dc 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -315,6 +315,9 @@ static git_pathspec_match_list *pathspec_match_alloc(
m = NULL;
}
+ if (!m)
+ return NULL;
+
/* need to keep reference to pathspec and increment refcount because
* failures array stores pointers to the pattern strings of the
* pathspec that had no matches