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

In reftable/writer.c:padded_write(), if w->writer failed, zeroed
allocated in `reftable_calloc` will leak. w->writer could be
`reftable_write_data` in reftable/stack.c, and could fail due to
some write error. Simply add reftable_free(zeroed) 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