summaryrefslogtreecommitdiff
path: root/src/attrcache.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-05-23 10:15:51 +0100
committerPatrick Steinhardt <ps@pks.im>2020-06-01 14:12:17 +0200
commit0f35efeb5722f950218e3649d7814a6a91b1c351 (patch)
treee53af9e934365660d0bacfd4c24b40434dfd353f /src/attrcache.c
parentabfdb8a6d252a4834df9234ad338c97f1a4f97f2 (diff)
downloadlibgit2-0f35efeb5722f950218e3649d7814a6a91b1c351.tar.gz
git_pool_init: handle failure casesethomson/poolinit
Propagate failures caused by pool initialization errors.
Diffstat (limited to 'src/attrcache.c')
-rw-r--r--src/attrcache.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/attrcache.c b/src/attrcache.c
index f02dd9d1d..47fb675e0 100644
--- a/src/attrcache.c
+++ b/src/attrcache.c
@@ -391,11 +391,10 @@ int git_attr_cache__init(git_repository *repo)
* hashtable for attribute macros, and string pool
*/
if ((ret = git_strmap_new(&cache->files)) < 0 ||
- (ret = git_strmap_new(&cache->macros)) < 0)
+ (ret = git_strmap_new(&cache->macros)) < 0 ||
+ (ret = git_pool_init(&cache->pool, 1)) < 0)
goto cancel;
- git_pool_init(&cache->pool, 1);
-
cache = git__compare_and_swap(&repo->attrcache, NULL, cache);
if (cache)
goto cancel; /* raced with another thread, free this but no error */