Re: [PATCH 01/11] rev-parse: fix a leak with --abbrev-ref
On 11-jun-2023 23:12:39, Jeff King wrote:
Show 19 quoted lines
> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
> index 852e49e340..6dc8548e1f 100644
> --- a/builtin/rev-parse.c
> +++ b/builtin/rev-parse.c
> @@ -156,9 +156,12 @@ static void show_rev(int type, const struct object_id *oid, const char *name)
> */
> break;
> case 1: /* happy */
> - if (abbrev_ref)
> - full = shorten_unambiguous_ref(full,
> + if (abbrev_ref) {
> + char *old = full;
> + full = shorten_unambiguous_ref(old,
> abbrev_ref_strict);
> + free(old);
> + }
> show_with_type(type, full);
> break;
> default: /* ambiguous */