]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/writer: fix memory leak when `writer_index_hash()` fails
authorLidong Yan <502024330056@smail.nju.edu.cn>
Mon, 12 May 2025 12:49:04 +0000 (12:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 May 2025 16:19:50 +0000 (09:19 -0700)
commit91db6c735dd1da215ae5e12506139f0aba5e426b
tree0134752d8016bcbe6cb3fa394b8c92814bda0a41
parentc8e752eaeff299012b582507fed078a7cecbb7a3
reftable/writer: fix memory leak when `writer_index_hash()` fails

In reftable/writer.c:writer_index_hash(), if `reftable_buf_add` failed,
key allocated by `reftable_malloc` will not be insert into `obj_index_tree`
thus leaks. Simple add reftable_free(key) will solve this problem.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/writer.c