Subject: Re: [PATCH iproute2 1/3] lib/fs: fix memory leak in get_task_name()

From: Stephen Hemminger <[email-masked]>
Date: Tue, 1 Feb 2022 10:27:12 -0800

On Tue,  1 Feb 2022 18:39:24 +0100
Andrea Claudi <[email-masked]> wrote:

> +	if (fscanf(f, "%ms\n", &comm) != 1) {
> +		free(comm);
> +		return NULL;

This is still leaking the original comm.

Why not change it to use a local variable for the path
(avoid asprintf) and not reuse comm for both pathname
and return value.