Re: [PATCH] show-branch: fix crash with long ref name
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 14, 2017, 19:35 UTC
- Message-ID
- <xmqqlgt88t0r.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170214172526.hzpm3d3ubd3vjnzr@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> This fixes the problem, but I think we can simplify it quite a bit by > using resolve_refdup(). Here's the patch series I ended up with: > > [1/3]: show-branch: drop head_len variable > [2/3]: show-branch: store resolved head in heap buffer > [3/3]: show-branch: use skip_prefix to drop magic numbers > > builtin/show-branch.c | 39 ++++++++++++--------------------------- > 1 file changed, 12 insertions(+), 27 deletions(-)
Yes, the whole thing is my fault ;-) and I agree with what these patches do.
The second one lacks free(head) but I think that is OK; it is something we allocate in cmd_*() and use pretty much thruout the rest of the program.
Thanks.