mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
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 <peff@peff.net> via Coverity Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
c0350cb964
commit
8a0bebdeae
@@ -1503,7 +1503,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
|
||||
*/
|
||||
ret = reftable_merged_table_seek_log(mt, &it, arg->oldname);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto done;
|
||||
|
||||
while (1) {
|
||||
ret = reftable_iterator_next_log(&it, &old_log);
|
||||
|
||||
Reference in New Issue
Block a user