Skip to content

Commit 8a0bebd

Browse files
pks-tgitster
authored andcommitted
refs/reftable: fix leak when copying reflog fails
When copying a ref with the reftable backend we also copy the corresponding log records. When seeking the first log record that we're about to copy fails though we directly return from `write_copy_table()` without doing any cleanup, leaking several allocated data structures. Fix this by exiting via our common cleanup logic instead. Reported-by: Jeff King <[email protected]> via Coverity Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c0350cb commit 8a0bebd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

refs/reftable-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
15031503
*/
15041504
ret = reftable_merged_table_seek_log(mt, &it, arg->oldname);
15051505
if (ret < 0)
1506-
return ret;
1506+
goto done;
15071507

15081508
while (1) {
15091509
ret = reftable_iterator_next_log(&it, &old_log);

0 commit comments

Comments
 (0)