]> git.ipfire.org Git - thirdparty/git.git/commit
pack-redundant: fix memory leak when open_pack_index() fails
authorSahitya Chandra <sahityajb@gmail.com>
Sat, 21 Feb 2026 10:38:59 +0000 (16:08 +0530)
committerJunio C Hamano <gitster@pobox.com>
Sun, 22 Feb 2026 05:26:53 +0000 (21:26 -0800)
commit7451864bfac0fc7ac829aceecd7f339b80dac732
tree3309158fb945ac791c88185727784f284c41d0ce
parent67ad42147a7acc2af6074753ebd03d904476118f
pack-redundant: fix memory leak when open_pack_index() fails

In add_pack(), we allocate l.remaining_objects with llist_init() before
calling open_pack_index(). If open_pack_index() fails we return NULL
without freeing the allocated list, leaking the memory.

Fix by calling llist_free(l.remaining_objects) on the error path before
returning.

Signed-off-by: Sahitya Chandra <sahityajb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-redundant.c