summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-14 08:52:06 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-14 10:07:58 -0700
commitd1c53f6703f34eeb3442070016db6e4d1f5676d2 (patch)
tree991324e01dcfd102400dd4f8bd017a7189b9c9a5 /builtin/commit.c
parentc81dcf630cec64d0042f08f7210300671ed5b926 (diff)
read-cache: fix leaking hashfile when writing index fails
In `do_write_index()`, we use a `struct hashfile` to write the index with a trailer hash. In case the write fails though, we never clean up the allocated `hashfile` state and thus leak memory. Refactor the code to have a common exit path where we can free this and other allocated memory. While at it, refactor our use of `strbuf`s such that we reuse the same buffer to avoid some unneeded allocations. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions