summaryrefslogtreecommitdiffstats
path: root/diffcore-break.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-26 13:47:08 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-27 17:25:37 +0200
commit12dfc2475ce4808df696fb67fc71a66793f78f06 (patch)
treec4f0e029443f3c29071d7d317d95aa2646eb66bb /diffcore-break.c
parentrevision: fix leaking parents when simplifying commits (diff)
downloadgit-12dfc2475ce4808df696fb67fc71a66793f78f06.tar.xz
git-12dfc2475ce4808df696fb67fc71a66793f78f06.zip
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>
Diffstat (limited to 'diffcore-break.c')
-rw-r--r--diffcore-break.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/diffcore-break.c b/diffcore-break.c
index 831b66b5c3..02735f80c6 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -266,8 +266,8 @@ static void merge_broken(struct diff_filepair *p,
* in the resulting tree.
*/
d->one->rename_used++;
- diff_free_filespec_data(d->two);
- diff_free_filespec_data(c->one);
+ free_filespec(d->two);
+ free_filespec(c->one);
free(d);
free(c);
}