branch: use ref_sorting_release()
commitd72d4f92e2e0fed38c6173c31e86b1b8881600e8
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 20 Oct 2021 18:27:21 +0000 (20 20:27 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Oct 2021 18:36:13 +0000 (20 11:36 -0700)
tree70489c867671e8303b51e705c660696b9785feca
parente5fb028688f5811bd835c0bc47f8d7a379a0d152
branch: use ref_sorting_release()

Use a ref_sorting_release() in branch.c to free the memory from the
ref_sorting_options(). This plugs the final in-tree memory leak of
that API.

In the preceding commit the "sorting" variable was left in the
cmd_branch() scope, even though that wasn't needed anymore. Move it to
the "else if (list)" scope instead. We can also move the "struct
string_list" only used for that branch to be declared in that block

That "struct ref_sorting" does not need to be "static" (and isn't
re-used). The "ref_sorting_options()" will return a valid one, we
don't need to make it "static" to have it zero'd out. That it was
static was another artifact of the pre-image of the preceding commit.

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