]> git.ipfire.org Git - thirdparty/git.git/commit - bisect.c
bisect.c: partially fix bisect_rev_setup() memory leak
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 2 Aug 2022 15:33:15 +0000 (17:33 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Aug 2022 18:01:03 +0000 (11:01 -0700)
commit57efebb9b96847adcd25bab0d2c21c599b8f1954
treee580bff2f05443efd62483811742e3abdd21d6a9
parentf89d085b3f6c4861265baed212c8ff6b7a8ec8e6
bisect.c: partially fix bisect_rev_setup() memory leak

Partially fix the memory leak noted in in 8a534b61241 (bisect: use
argv_array API, 2011-09-13), which added the "XXX" comment seen in the
context. We can partially fix it by having the bisect_rev_setup()
function take a "struct strvec", rather than constructing it.

As the comment notes we need to keep the construct "rev_argv" around
while the "struct rev_info" is around, which as seen in the newly
added "strvec_clear()" calls here we do after "release_revisions()".

This "partially" fixes the memory leak because we're leaking the "--"
added to the "rev_argv" here still, which will be addressed in a
subsequent commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c