]> git.ipfire.org Git - thirdparty/git.git/commit
merge-ort: fix two leaks when handling directory rename modifications
authorPatrick Steinhardt <ps@pks.im>
Thu, 5 Sep 2024 10:09:39 +0000 (12:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2024 15:49:13 +0000 (08:49 -0700)
commited78f048ae369e9076689cca71ff99f2baa90cd2
tree1962390ad58a054841ed4ef34a9241e263f57b38
parent2a0147089151e3dd2cc8e6c91ecaf45fb416630e
merge-ort: fix two leaks when handling directory rename modifications

There are two leaks in `apply_directory_rename_modifications()`:

  - We do not release the `dirs_to_insert` string list.

  - We do not release some `conflict_info` we put into the
    `opt->priv->paths` string map.

The former is trivial to fix. The latter is a bit less straight forward:
the `util` pointer of the string map may sometimes point to data that
has been allocated via `CALLOC()`, while at other times it may point to
data that has been allocated via a `mem_pool`.

It very much seems like an oversight that we didn't also allocate the
conflict info in this code path via the memory pool, though. So let's
fix that, which will also plug the memory leak for us.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-ort.c
t/t6423-merge-rename-directories.sh