sha1_file.c: do not die failing to malloc in unpack_compressed_entry
[gitweb.git] / sha1_file.c
index 3f70b1d86aaa8e0648d8a3c6ebb6aca701ae7475..8db73f0c53f01bf39decb71d036610d2835cf7ac 100644 (file)
@@ -1923,7 +1923,9 @@ static void *unpack_compressed_entry(struct packed_git *p,
        git_zstream stream;
        unsigned char *buffer, *in;
 
-       buffer = xmallocz(size);
+       buffer = xmallocz_gently(size);
+       if (!buffer)
+               return NULL;
        memset(&stream, 0, sizeof(stream));
        stream.next_out = buffer;
        stream.avail_out = size + 1;