summaryrefslogtreecommitdiff
path: root/git-mergetool.sh
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2022-03-04 19:32:14 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-03-04 13:24:19 -0800
commitef3fe214484f79afdad4204d56e0ee7ff6e85a0f (patch)
tree8b092aee35aad647d502c7b5e862a0f88add5e8a /git-mergetool.sh
parentcommit-graph: stop fill_oids_from_packs() progress on error and free() (diff)
downloadtgif-ef3fe214484f79afdad4204d56e0ee7ff6e85a0f.tar.xz
lockfile API users: simplify and don't leak "path"
Fix a memory leak in code added in 6c622f9f0bb (commit-graph: write commit-graph chains, 2019-06-18). We needed to free the "lock_name" if we encounter errors, and the "graph_name" after we'd run unlink() on it. For the case of write_commit_graph_file() refactoring the code to free the "lock_name" after we were done using the "struct lock_file lk" would have made the control flow more complex. Luckily we can free the "lock_file" right after the hold_lock_file_for_update() call, if it makes use of "path" at all it'll have copied its contents to a "struct strbuf" of its own. While I'm at it let's fix code added in fb10ca5b543 (sparse-checkout: write using lockfile, 2019-11-21) in write_patterns_and_update() to avoid the same complexity that I thought I needed when I wrote the initial fix for write_commit_graph_file(). We can free the "sparse_filename" right after calling hold_lock_file_for_update(), we don't need to wait until we're exiting the function to do so. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-mergetool.sh')
0 files changed, 0 insertions, 0 deletions