Re: [PATCH 5/6] reflog: free() ref given to us by dwim_log()

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

 



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

> When dwim_log() returns the "ref" is always ether NULL or an
> xstrdup()'d string.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
> ---
>  builtin/reflog.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/builtin/reflog.c b/builtin/reflog.c
> index bd4c669918d..175c83e7cc2 100644
> --- a/builtin/reflog.c
> +++ b/builtin/reflog.c
> @@ -653,6 +653,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
>  					should_expire_reflog_ent,
>  					reflog_expiry_cleanup,
>  					&cb);
> +		free(ref);

OK.  When dwim_log() returns false, it would not have touched &ref
at all, so the "continue" (not shown in the context above) is not
leaking, and this loop looks good.

Thanks.

>  	}
>  	return status;
>  }




[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