Commit 2d73075a41628634fa0c5572d760ad3aafffcf82

Carlos Martín Nieto 2015-06-10T10:23:08

cache: add a check for a failed allocation Rather minimal change, but it's the kind of thing we should do.

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/cache.c b/src/cache.c
index 8dc9cbf..2f3ad15 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -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;