diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2020-05-23 10:15:51 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-06-01 14:12:17 +0200 |
commit | 0f35efeb5722f950218e3649d7814a6a91b1c351 (patch) | |
tree | e53af9e934365660d0bacfd4c24b40434dfd353f /src/pathspec.c | |
parent | abfdb8a6d252a4834df9234ad338c97f1a4f97f2 (diff) | |
download | libgit2-ethomson/poolinit.tar.gz |
git_pool_init: handle failure casesethomson/poolinit
Propagate failures caused by pool initialization errors.
Diffstat (limited to 'src/pathspec.c')
-rw-r--r-- | src/pathspec.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pathspec.c b/src/pathspec.c index 19ea9eb19..83f776c91 100644 --- a/src/pathspec.c +++ b/src/pathspec.c @@ -238,9 +238,9 @@ int git_pathspec__init(git_pathspec *ps, const git_strarray *paths) memset(ps, 0, sizeof(*ps)); ps->prefix = git_pathspec_prefix(paths); - git_pool_init(&ps->pool, 1); - if ((error = git_pathspec__vinit(&ps->pathspec, paths, &ps->pool)) < 0) + if ((error = git_pool_init(&ps->pool, 1)) < 0 || + (error = git_pathspec__vinit(&ps->pathspec, paths, &ps->pool)) < 0) git_pathspec__clear(ps); return error; @@ -316,7 +316,8 @@ static git_pathspec_match_list *pathspec_match_alloc( if (!m) return NULL; - git_pool_init(&m->pool, 1); + if (git_pool_init(&m->pool, 1) < 0) + return NULL; /* need to keep reference to pathspec and increment refcount because * failures array stores pointers to the pattern strings of the |