diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-01-01 09:21:13 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-01-01 09:21:13 -0800 |
| commit | 73e35b172a74cfab8f1db450113f2bf826b40b60 (patch) | |
| tree | e11a2f43cfbd98fb8bb589e2be9ccf38eeb19302 /reftable/stack.c | |
| parent | Git 2.48-rc1 (diff) | |
| parent | t-reftable-merged: handle realloc errors (diff) | |
| download | git-73e35b172a74cfab8f1db450113f2bf826b40b60.tar.gz git-73e35b172a74cfab8f1db450113f2bf826b40b60.zip | |
Merge branch 'rs/reftable-realloc-errors'
The custom allocator code in the reftable library did not handle
failing realloc() very well, which has been addressed.
* rs/reftable-realloc-errors:
t-reftable-merged: handle realloc errors
reftable: handle realloc error in parse_names()
reftable: fix allocation count on realloc error
reftable: avoid leaks on realloc error
Diffstat (limited to 'reftable/stack.c')
| -rw-r--r-- | reftable/stack.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/reftable/stack.c b/reftable/stack.c index 634f0c5425..531660a49f 100644 --- a/reftable/stack.c +++ b/reftable/stack.c @@ -317,7 +317,9 @@ static int reftable_stack_reload_once(struct reftable_stack *st, * thus need to keep them alive here, which we * do by bumping their refcount. */ - REFTABLE_ALLOC_GROW(reused, reused_len + 1, reused_alloc); + REFTABLE_ALLOC_GROW_OR_NULL(reused, + reused_len + 1, + reused_alloc); if (!reused) { err = REFTABLE_OUT_OF_MEMORY_ERROR; goto done; @@ -949,8 +951,8 @@ int reftable_addition_add(struct reftable_addition *add, if (err < 0) goto done; - REFTABLE_ALLOC_GROW(add->new_tables, add->new_tables_len + 1, - add->new_tables_cap); + REFTABLE_ALLOC_GROW_OR_NULL(add->new_tables, add->new_tables_len + 1, + add->new_tables_cap); if (!add->new_tables) { err = REFTABLE_OUT_OF_MEMORY_ERROR; goto done; |
