diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-08-14 08:52:55 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-14 19:08:01 +0200 |
commit | 36f971f86182a25fa2fa4af680bf79f522a27f60 (patch) | |
tree | 533e024f52ef2a51fcd94bcf5a1581f9ed8dcd9c /diff.c | |
parent | builtin/log: fix leak when showing converted blob contents (diff) | |
download | git-36f971f86182a25fa2fa4af680bf79f522a27f60.tar.xz git-36f971f86182a25fa2fa4af680bf79f522a27f60.zip |
diff: free state populated via options
The `objfind` and `anchors` members of `struct diff_options` are
populated via option parsing, but are never freed in `diff_free()`. Fix
this to plug those memory leaks.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -6717,6 +6717,16 @@ void diff_free(struct diff_options *options) if (options->no_free) return; + if (options->objfind) { + oidset_clear(options->objfind); + FREE_AND_NULL(options->objfind); + } + + for (size_t i = 0; i < options->anchors_nr; i++) + free(options->anchors[i]); + FREE_AND_NULL(options->anchors); + options->anchors_nr = options->anchors_alloc = 0; + diff_free_file(options); diff_free_ignore_regex(options); clear_pathspec(&options->pathspec); |