Subject: Re: [PATCH v6 17/19] receive-pack: free() the "ref_name" in "struct command"

From: Junio C Hamano <[email-masked]>
Date: Thu, 02 Feb 2023 13:55:31 -0800

Ævar Arnfjörð Bjarmason  <[email-masked]> writes:

> Fix a memory leak that's been with us since this code was introduced
> in 575f497456e (Add first cut at "git-receive-pack", 2005-06-29). See
> eb1af2df0b1 (git-receive-pack: start parsing ref update commands,
> 2005-06-29) for the later change that refactored the code to add the
> "ref_name" member.

The above description does not really match what the patch does,
though.  Yes, command.ref_name[] member held varying number of bytes
in it, but the code was leaking a singly linked list of the entire
command structure, not just ref_name[] member.  And the patch makes
sure we will release the resource held by the entire chain, not just
the ref_name flex-array member.