]> git.ipfire.org Git - thirdparty/git.git/commit
diffcore-break: fix leaking filespecs when merging broken pairs
authorPatrick Steinhardt <ps@pks.im>
Thu, 26 Sep 2024 11:47:08 +0000 (13:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Sep 2024 15:25:37 +0000 (08:25 -0700)
commit12dfc2475ce4808df696fb67fc71a66793f78f06
treec4f0e029443f3c29071d7d317d95aa2646eb66bb
parentfa016423c748cd142a40c10eb7f9cc4c4fffbb98
diffcore-break: fix leaking filespecs when merging broken pairs

When merging file pairs after they have been broken up we queue a new
file pair and discard the broken-up ones. The newly-queued file pair
reuses one filespec of the broken up pairs each, where the respective
other filespec gets discarded. But we only end up freeing the filespec's
data, not the filespec itself, and thus leak memory.

Fix these leaks by using `free_filespec()` instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-break.c
t/t4008-diff-break-rewrite.sh
t/t4022-diff-rewrite.sh
t/t4023-diff-rename-typechange.sh
t/t4031-diff-rewrite-binary.sh
t/t7524-commit-summary.sh