mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
Merge branch 'ps/reftable-alloc-failures-zalloc-fix'
Recent reftable updates mistook a NULL return from a request for 0-byte allocation as OOM and died unnecessarily, which has been corrected. * ps/reftable-alloc-failures-zalloc-fix: reftable/basics: return NULL on zero-sized allocations reftable/stack: fix zero-sized allocation when there are no readers reftable/merged: fix zero-sized allocation when there are no readers reftable/stack: don't perform auto-compaction with less than two tables
This commit is contained in:
@@ -240,14 +240,16 @@ int merged_table_init_iter(struct reftable_merged_table *mt,
|
||||
struct reftable_iterator *it,
|
||||
uint8_t typ)
|
||||
{
|
||||
struct merged_subiter *subiters;
|
||||
struct merged_subiter *subiters = NULL;
|
||||
struct merged_iter *mi = NULL;
|
||||
int ret;
|
||||
|
||||
REFTABLE_CALLOC_ARRAY(subiters, mt->readers_len);
|
||||
if (!subiters) {
|
||||
ret = REFTABLE_OUT_OF_MEMORY_ERROR;
|
||||
goto out;
|
||||
if (mt->readers_len) {
|
||||
REFTABLE_CALLOC_ARRAY(subiters, mt->readers_len);
|
||||
if (!subiters) {
|
||||
ret = REFTABLE_OUT_OF_MEMORY_ERROR;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mt->readers_len; i++) {
|
||||
|
||||
Reference in New Issue
Block a user