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