diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-12-22 08:24:30 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-12-22 00:58:23 -0800 |
commit | 2d3cb4b4b5401e2fd5a40600277f424032fc72f0 (patch) | |
tree | a774b7a09609d0a84700f78c39d026ac569a74cd /builtin/commit.c | |
parent | 5ab83521cfe687e4295f5748f2c5d2aa7477efe5 (diff) |
reftable/stack: fix zero-sized allocation when there are no readers
Similar as the preceding commit, we may try to do a zero-sized
allocation when reloading a reftable stack that ain't got any tables.
It is implementation-defined whether malloc(3p) returns a NULL pointer
in that case or a zero-sized object. In case it does return a NULL
pointer though it causes us to think we have run into an out-of-memory
situation, and thus we return an error.
Fix this by only allocating arrays when they have at least one entry.
Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions