From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Christian Couder <chriscool@tuxfamily•org>,
git@vger•kernel.org, Johan Herland <johan@herland•net>,
Josh Triplett <josh@joshtriplett•org>,
Thomas Rast <tr@thomasrast•ch>,
Michael Haggerty <mhagger@alum•mit.edu>,
Dan Carpenter <dan.carpenter@oracle•com>,
Greg Kroah-Hartman <greg@kroah•com>,
Eric Sunshine <sunshine@sunshineco•com>,
Ramsay Jones <ramsay@ramsay1•demon.co.uk>,
Jonathan Nieder <jrnieder@gmail•com>,
Marc Branchaud <marcnarc@xiplink•com>
Subject: Re: [PATCH 2/5] trailer: display a trailer without its trailing newline
Date: Fri, 07 Nov 2014 11:26:04 -0800 [thread overview]
Message-ID: <xmqqd28yg6cz.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20141107192239.GC5695@peff.net> (Jeff King's message of "Fri, 7 Nov 2014 14:22:39 -0500")
Jeff King <peff@peff•net> writes:
> 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?
Yes. "%.*s" might be your friend.
next prev parent reply other threads:[~2014-11-07 19:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 18:50 [PATCH 0/5] Small "git interpret-trailers" fixes Christian Couder
2014-11-07 18:50 ` [PATCH 1/5] trailer: ignore comment lines inside the trailers Christian Couder
2014-11-07 18:50 ` [PATCH 2/5] trailer: display a trailer without its trailing newline Christian Couder
2014-11-07 19:22 ` Jeff King
2014-11-07 19:26 ` Junio C Hamano [this message]
2014-11-07 18:50 ` [PATCH 3/5] commit: make ignore_non_trailer() non static Christian Couder
2014-11-07 18:50 ` [PATCH 4/5] trailer: reuse ignore_non_trailer() to ignore conflict lines Christian Couder
2014-11-07 20:27 ` Junio C Hamano
2014-11-09 10:35 ` Christian Couder
2014-11-09 16:45 ` Junio C Hamano
2014-11-09 18:24 ` Junio C Hamano
2014-11-09 22:40 ` Junio C Hamano
2014-11-07 18:50 ` [PATCH 5/5] trailer: add test with an old style conflict block Christian Couder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqd28yg6cz.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=chriscool@tuxfamily$(echo .)org \
--cc=dan.carpenter@oracle$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=greg@kroah$(echo .)com \
--cc=johan@herland$(echo .)net \
--cc=josh@joshtriplett$(echo .)org \
--cc=jrnieder@gmail$(echo .)com \
--cc=marcnarc@xiplink$(echo .)com \
--cc=mhagger@alum$(echo .)mit.edu \
--cc=peff@peff$(echo .)net \
--cc=ramsay@ramsay1$(echo .)demon.co.uk \
--cc=sunshine@sunshineco$(echo .)com \
--cc=tr@thomasrast$(echo .)ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox