mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
cache: add a check for a failed allocation
Rather minimal change, but it's the kind of thing we should do.
This commit is contained in:
@@ -68,6 +68,7 @@ int git_cache_init(git_cache *cache)
|
||||
{
|
||||
memset(cache, 0, sizeof(*cache));
|
||||
cache->map = git_oidmap_alloc();
|
||||
GITERR_CHECK_ALLOC(cache->map);
|
||||
if (git_rwlock_init(&cache->lock)) {
|
||||
giterr_set(GITERR_OS, "Failed to initialize cache rwlock");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user