Re: [PATCH 2/5] trailer: display a trailer without its trailing newline

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

 



On Fri, Nov 07, 2014 at 07:50:49PM +0100, Christian Couder wrote:

> diff --git a/trailer.c b/trailer.c
> index 761b763..f4d51ba 100644
> --- a/trailer.c
> +++ b/trailer.c
> @@ -583,8 +583,12 @@ static int parse_trailer(struct strbuf *tok, struct strbuf *val, const char *tra
>  	strbuf_addch(&seps, '=');
>  	len = strcspn(trailer, seps.buf);
>  	strbuf_release(&seps);
> -	if (len == 0)
> -		return error(_("empty trailer token in trailer '%s'"), trailer);
> +	if (len == 0) {
> +		struct strbuf sb = STRBUF_INIT;
> +		strbuf_addstr(&sb, trailer);
> +		strbuf_rtrim(&sb);
> +		return error(_("empty trailer token in trailer '%s'"), sb.buf);
> +	}

Doesn't this leak sb.buf?

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]