git/reftable
Johannes Schindelin d321f42c09 reftable/stack: guard against NULL list_file in stack_destroy
When reftable_new_stack() fails partway through initialization
(e.g., reftable_buf_addstr returns an OOM error before
reftable_buf_detach assigns p->list_file), it jumps to the error
path which calls reftable_stack_destroy(p). At that point,
p->list_file is still NULL because the detach never happened.

reftable_stack_destroy() passes st->list_file unconditionally to
read_lines(), which calls open(filename, O_RDONLY). Passing NULL
to open() is undefined behavior and will typically crash.

Guard the read_lines() call with a NULL check on st->list_file.
When list_file is NULL, there are no table files to clean up
anyway, so skipping read_lines is the correct behavior.

Pointed out by Coverity.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-10 08:13:54 -07:00
..
LICENSE
basics.c reftable: check for trailing newline in 'tables.list' 2025-10-07 09:22:57 -07:00
basics.h reftable: check for trailing newline in 'tables.list' 2025-10-07 09:22:57 -07:00
block.c Merge branch 'ps/reftable-read-block-perffix' 2025-05-19 16:02:48 -07:00
block.h Merge branch 'ps/reftable-api-revamp' 2025-04-29 14:21:30 -07:00
blocksource.c reftable/system: add abstraction to mmap files 2026-04-02 10:45:44 -07:00
blocksource.h reftable/block: rename `block` to `block_data` 2025-04-07 14:53:10 -07:00
constants.h reftable/constants: make block types part of the public interface 2025-04-07 14:53:12 -07:00
error.c reftable: fix formatting of the license header 2025-04-07 14:53:09 -07:00
fsck.c reftable/fsck: use REFTABLE_UNUSED instead of UNUSED 2026-04-02 10:45:43 -07:00
iter.c reftable/constants: make block types part of the public interface 2025-04-07 14:53:12 -07:00
iter.h reftable/block: rename `block_reader` to `reftable_block` 2025-04-07 14:53:10 -07:00
merged.c reftable/constants: make block types part of the public interface 2025-04-07 14:53:12 -07:00
merged.h reftable/reader: rename data structure to "table" 2025-04-07 14:53:09 -07:00
pq.c reftable: fix formatting of the license header 2025-04-07 14:53:09 -07:00
pq.h reftable: fix formatting of the license header 2025-04-07 14:53:09 -07:00
record.c Merge branch 'ps/reftable-api-revamp' 2025-04-29 14:21:30 -07:00
record.h reftable: fix formatting of the license header 2025-04-07 14:53:09 -07:00
reftable-basics.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-block.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-blocksource.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-constants.h reftable/constants: make block types part of the public interface 2025-04-07 14:53:12 -07:00
reftable-error.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-fsck.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-iterator.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-merged.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-record.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-stack.h reftable: split up write options 2026-06-26 08:27:19 -07:00
reftable-system.h reftable/stack: provide fsync(3p) via system header 2026-04-02 10:45:43 -07:00
reftable-table.h reftable: introduce "reftable-system.h" header 2026-04-02 10:45:43 -07:00
reftable-writer.h reftable: split up write options 2026-06-26 08:27:19 -07:00
stack.c reftable/stack: guard against NULL list_file in stack_destroy 2026-07-10 08:13:54 -07:00
stack.h reftable: split up write options 2026-06-26 08:27:19 -07:00
system.c reftable/system: add abstraction to mmap files 2026-04-02 10:45:44 -07:00
system.h doc: fix typos via codespell 2026-06-08 00:21:35 +09:00
table.c reftable: fix perf regression when reading blocks of unwanted type 2025-05-12 10:55:24 -07:00
table.h reftable/table: add `reftable_table` to the public interface 2025-04-07 14:53:12 -07:00
tree.c reftable: fix formatting of the license header 2025-04-07 14:53:09 -07:00
tree.h reftable: fix formatting of the license header 2025-04-07 14:53:09 -07:00
writer.c reftable: split up write options 2026-06-26 08:27:19 -07:00
writer.h reftable: split up write options 2026-06-26 08:27:19 -07:00