From f6442063775b68d9eeaeb9088379fba3298c80ac Mon Sep 17 00:00:00 2001 From: Karthik Nayak Date: Tue, 7 Oct 2025 14:11:27 +0200 Subject: reftable: check for trailing newline in 'tables.list' In the reftable format, the 'tables.list' file contains a newline separated list of tables. While we parse this file, we do not check or care about the last newline. Tighten the parser in `parse_names()` to return an appropriate error if the last newline is missing. This requires modification to `parse_names()` to now return the error while accepting the output as a third argument. Signed-off-by: Karthik Nayak Signed-off-by: Junio C Hamano --- reftable/stack.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'reftable/stack.c') diff --git a/reftable/stack.c b/reftable/stack.c index 4caf96aa1d..7df872d0fb 100644 --- a/reftable/stack.c +++ b/reftable/stack.c @@ -169,12 +169,7 @@ static int fd_read_lines(int fd, char ***namesp) } buf[size] = 0; - *namesp = parse_names(buf, size); - if (!*namesp) { - err = REFTABLE_OUT_OF_MEMORY_ERROR; - goto done; - } - + err = parse_names(buf, size, namesp); done: reftable_free(buf); return err; -- cgit v1.3