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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patrick Steinhardt <ps@xxxxxx> 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.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux