[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220307101454.24c02c76@hermes.local>
Date: Mon, 7 Mar 2022 10:14:54 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: David Ahern <dsahern@...nel.org>
Cc: Andrea Claudi <aclaudi@...hat.com>, netdev@...r.kernel.org,
markzhang@...dia.com, leonro@...dia.com
Subject: Re: [PATCH iproute2 v2 1/2] lib/fs: fix memory leak in
get_task_name()
On Mon, 7 Mar 2022 10:58:37 -0700
David Ahern <dsahern@...nel.org> wrote:
> On 3/2/22 5:28 AM, Andrea Claudi wrote:
> > diff --git a/include/utils.h b/include/utils.h
> > index b6c468e9..81294488 100644
> > --- a/include/utils.h
> > +++ b/include/utils.h
> > @@ -307,7 +307,7 @@ char *find_cgroup2_mount(bool do_mount);
> > __u64 get_cgroup2_id(const char *path);
> > char *get_cgroup2_path(__u64 id, bool full);
> > int get_command_name(const char *pid, char *comm, size_t len);
> > -char *get_task_name(pid_t pid);
> > +int get_task_name(pid_t pid, char *name);
> >
>
> changing to an API with an assumed length is not better than the current
> situation. Why not just fixup the callers as needed to free the allocation?
I wonder if iproute2 should start using GCC attribute cleanup function
(like systemd) or would this be too much of using a new thing?
Not sure if using the attribute (wrapped in macro) just hides the problem
Powered by blists - more mailing lists