Re: [PATCH 2/2] commit: use strbuf_release() instead of UNLEAK()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> 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?

> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
> ---
>  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;
>  }




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux