summaryrefslogtreecommitdiffstats
path: root/revision.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-06-11 11:19:45 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-11 22:15:05 +0200
commit97485374377fa62fdd36f4b707e2fcd8f1a7c6c3 (patch)
treef37b7563648e311dc7f7d86f179bb38731e6c0b5 /revision.c
parentmerge-recursive: fix leaking rename conflict info (diff)
downloadgit-97485374377fa62fdd36f4b707e2fcd8f1a7c6c3.tar.xz
git-97485374377fa62fdd36f4b707e2fcd8f1a7c6c3.zip
revision: fix leaking display notes
We never free the display notes options embedded into `struct revision`. Implement a new function `release_display_notes()` that we can call in `release_revisions()` to fix this. There is another gotcha here though: we play some games with the string list used to track extra notes refs, where we sometimes set the bit that indicates that strings should be strdup'd and sometimes unset it. This dance is done to avoid a copy of an already-allocated string when we call `enable_ref_display_notes()`. But this dance is rather pointless as we can instead call `string_list_append_nodup()` to transfer ownership of the allocated string to the list. Refactor the code to do so and drop the `strdup_strings` dance. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index af95502d92..75e71bcaea 100644
--- a/revision.c
+++ b/revision.c
@@ -3168,6 +3168,7 @@ void release_revisions(struct rev_info *revs)
{
free_commit_list(revs->commits);
free_commit_list(revs->ancestry_path_bottoms);
+ release_display_notes(&revs->notes_opt);
object_array_clear(&revs->pending);
object_array_clear(&revs->boundary_commits);
release_revisions_cmdline(&revs->cmdline);