diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-02-11 11:45:35 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-11 09:21:07 -0800 |
commit | c45dc9cf30a6f7f40adb3ea70dd2f2905ecd4afa (patch) | |
tree | 622b2b4ae4cc83c5f939878413accfba45579389 /builtin/log.c | |
parent | diff: add an API for deferred freeing (diff) | |
download | tgif-c45dc9cf30a6f7f40adb3ea70dd2f2905ecd4afa.tar.xz |
diff: plug memory leak from regcomp() on {log,diff} -I
Fix a memory leak in 296d4a94e7 (diff: add -I<regex> that ignores
matching changes, 2020-10-20) by freeing the memory it allocates in
the newly introduced diff_free(). See the previous commit for details
on that.
This memory leak was intentionally introduced in 296d4a94e7, see the
discussion on a previous iteration of it in
https://lore.kernel.org/git/xmqqeelycajx.fsf@gitster.c.googlers.com/
At that time freeing the memory was somewhat tedious, but since it
isn't anymore with the newly introduced diff_free() let's use it.
Let's retain the pattern for diff_free_file() and add a
diff_free_ignore_regex(), even though (unlike "diff_free_file") we
don't need to call it elsewhere. I think this'll make for more
readable code than gradually accumulating a giant diff_free()
function, sharing "int i" across unrelated code etc.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/log.c')
0 files changed, 0 insertions, 0 deletions