Subject: Re: [PATCH 02/20] transport-helper: fix leaking helper name

From: Junio C Hamano <[email-masked]>
Date: Thu, 23 May 2024 10:36:13 -0700

Patrick Steinhardt <[email-masked]> writes:

> When initializing the transport helper in `transport_get()`, we
> allocate the name of the helper. We neither end up transferring
> ownership of the name, nor do we free it. The associated memory thus
> leaks.
>
> Fix this memory leak and mark now-passing tests as leak free.

It would be more helpful to the readers if this said "Fix this
memory leak by having the helper own the memory, and mark ...".

Not a huge deal, though.

>  struct helper_data {
> -	const char *name;
> +	char *name;
>  	struct child_process *helper;
>  	FILE *out;
>  	unsigned fetch : 1,
> @@ -111,6 +111,7 @@ static void do_take_over(struct transport *transport)
>  	data = (struct helper_data *)transport->data;
>  	transport_take_over(transport, data->helper);
>  	fclose(data->out);
> +	free(data->name);
>  	free(data);
>  }

The patch is looking good.  Thanks.