Re: [PATCH 2/2] commit: use strbuf_release() instead of UNLEAK()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 16, 2022, 18:03 UTC
- Message-ID
- <xmqqa6equ1rq.fsf@gitster.g>
- In-Reply-To
- <patch-2.2-e3e78c9e40b-20220216T081844Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 8 quoted lines
> Convert the UNLEAK() added in 0e5bba53af7 (add UNLEAK annotation for > reducing leak false positives, 2017-09-08) to release the memory using > strbuf_release() instead. > > The tests being marked as passing with > "TEST_PASSES_SANITIZE_LEAK=true" already passed before due to the > UNLEAK(), but now they really don't leak memory, so let's mark them as > such.
That smells like a brave move.
Specifically, the cited commit turned an existing strbuf_release() on &err into UNLEAK(). If that and the other strbuf (sb) were so easily releasable, why didn't we do so back then already?
Show 21 quoted lines
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > --- > builtin/commit.c | 4 ++-- > t/t2203-add-intent.sh | 1 + > t/t7011-skip-worktree-reading.sh | 1 + > 3 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/builtin/commit.c b/builtin/commit.c > index 696b3527adf..c38ae2b7656 100644 > --- a/builtin/commit.c > +++ b/builtin/commit.c > @@ -1866,7 +1866,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) > > cleanup: > strbuf_release(&author_ident); > - UNLEAK(err); > - UNLEAK(sb); > + strbuf_release(&err); > + strbuf_release(&sb); > return ret; > }