grep API: plug memory leaks by freeing "header_list"

When the "header_list" struct member was added in [1], freeing this
field was neglected. Fix that now, so that commands like

	./git -P log -1 --color=always --author=A origin/master

will run leak-free.

1. 80235ba79e ("log --author=me --grep=it" should find intersection,
   not union, 2010-01-17)

Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2023-02-07 00:07:51 +01:00 committed by Junio C Hamano
parent 891c9965fb
commit fb2ebe72a3

1
grep.c
View File

@ -795,6 +795,7 @@ static void free_grep_pat(struct grep_pat *pattern)
void free_grep_patterns(struct grep_opt *opt)
{
free_grep_pat(opt->pattern_list);
free_grep_pat(opt->header_list);
if (opt->pattern_expression)
free_pattern_expr(opt->pattern_expression);