summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-24 17:50:39 -0400
committerJunio C Hamano <gitster@pobox.com>2024-09-25 10:24:52 -0700
commit61133e6ebb9dc2fbbc2cc15eeb5b5da4232ca405 (patch)
tree56f63a517a5255770a45a8cff6d8c5fd72c484b2 /commit.c
parent2ccf570efeb673a28f6f84c749238b33aa1be688 (diff)
shallow: fix leak when unregistering last shallow root
When unregistering a shallow root we shrink the array of grafts by one and move remaining grafts one to the left. This can of course only happen when there are any grafts left, because otherwise there is nothing to move. As such, this code is guarded by a condition that only performs the move in case there are grafts after the position of the graft to be unregistered. By mistake we also put the call to free the unregistered graft into that condition. But that doesn't make any sense, as we want to always free the graft when it exists. Fix the resulting memory leak by doing so. This leak is exposed by t5500, but plugging it does not make the whole test suite pass. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions