Re: [PATCH v2 4/6] tr2: fix memory leak & logic error in 2f732bf15e6
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Aug 26, 2021, 15:58 UTC
- Message-ID
- <CAPig+cSXQGbOMCNNF84aMA4MDFMbRc0z5xuKVoVJUQou6c1GkA@mail.gmail.com>
- In-Reply-To
- <patch-v2-4.6-1aa0dbc394e-20210826T121820Z-avarab@gmail.com>
On Thu, Aug 26, 2021 at 8:22 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> [...] > Let's move all the freeing of the memory to the end of the > function. If we're still at STRBUF_INIT with "name" due to not haven
s/haven/having/
Show 6 quoted lines
> taken the branch where the strbuf_read_file() succeeds freeing it is > redundant, so we could move it into the body of the "if", but just > handling freeing the same way for all branches of the function makes > it more readable. > [...] > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>