mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 14:39:10 +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:
parent
a166466cd1
commit
2d73075a41
@ -68,6 +68,7 @@ int git_cache_init(git_cache *cache)
|
|||||||
{
|
{
|
||||||
memset(cache, 0, sizeof(*cache));
|
memset(cache, 0, sizeof(*cache));
|
||||||
cache->map = git_oidmap_alloc();
|
cache->map = git_oidmap_alloc();
|
||||||
|
GITERR_CHECK_ALLOC(cache->map);
|
||||||
if (git_rwlock_init(&cache->lock)) {
|
if (git_rwlock_init(&cache->lock)) {
|
||||||
giterr_set(GITERR_OS, "Failed to initialize cache rwlock");
|
giterr_set(GITERR_OS, "Failed to initialize cache rwlock");
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user