[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220201102712.1390ae4d@hermes.local>
Date: Tue, 1 Feb 2022 10:27:12 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Andrea Claudi <aclaudi@...hat.com>
Cc: netdev@...r.kernel.org, dsahern@...il.com, markzhang@...dia.com,
leonro@...dia.com
Subject: Re: [PATCH iproute2 1/3] lib/fs: fix memory leak in get_task_name()
On Tue, 1 Feb 2022 18:39:24 +0100
Andrea Claudi <aclaudi@...hat.com> 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.
Powered by blists - more mailing lists