]> git.ipfire.org Git - thirdparty/git.git/commit - range-diff.c
range-diff: plug memory leak in read_patches()
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 4 Mar 2022 18:32:16 +0000 (19:32 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Mar 2022 21:24:19 +0000 (13:24 -0800)
commit2d102c2bca1a0c50f17108189f134279cad941cd
tree520e1d7953744b5f931fe706117406cd3e560bff
parent4998e93fa6e0da45440dd344419974e46d81a165
range-diff: plug memory leak in read_patches()

Amend code added in d9c66f0b5bf (range-diff: first rudimentary
implementation, 2018-08-13) to use a "goto cleanup" pattern. This
makes for less code, and frees memory that we'd previously leak.

The reason for changing free(util) to FREE_AND_NULL(util) is because
at the end of the function we append the contents of "util" to a
"struct string_list" if it's non-NULL.

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