Re: [PATCH 20/20] grep API: plug memory leaks by freeing "header_list"
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Dec 28, 2022, 19:36 UTC
- Message-ID
- <CAPig+cS3-j9hHwuoP-vOsbwwTDWPm4RLxPKi0Tn_sWqbNm8KRg@mail.gmail.com>
- In-Reply-To
- <patch-20.20-8ecc68c3e93-20221228T175512Z-avarab@gmail.com>
On Wed, Dec 28, 2022 at 1:03 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 7 quoted lines
> When the "header_list" struct member was added in [1] it wasn't made > to free the list using loop added for the adjacent "pattern_list" > member, see [2] for when we started freeing it. > > Let's start doing o by splitting up the loop in free_grep_patterns() > into a utility function. This makes e.g. this command leak-free when > run on git.git:
s/o by/so by/
Show 8 quoted lines
> ./git -P log -1 --color=always --author=A origin/master
>
> 1. 80235ba79ef ("log --author=me --grep=it" should find intersection,
> not union, 2010-01-17)
> 2. b48fb5b6a95 (grep: free expressions and patterns when done.,
> 2006-09-27)
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>