Re: [PATCH] iio: core: fix memleak in iio_device_register_sysfs

From: andy . shevchenko
Date: Sun Feb 11 2024 - 14:16:51 EST


Sun, Dec 17, 2023 at 01:28:00PM +0000, Jonathan Cameron kirjoitti:
> On Sun, 10 Dec 2023 13:32:28 +0000
> Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> > On Fri, 8 Dec 2023 15:31:19 +0800
> > Dinghao Liu <dinghao.liu@xxxxxxxxxx> wrote:
> >
> > > When iio_device_register_sysfs_group() fails, we should
> > > free iio_dev_opaque->chan_attr_group.attrs to prevent
> > > potential memleak.
> > >
> > > Fixes: 32f171724e5c ("iio: core: rework iio device group creation")
> > > Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
> > Hi.
> >
> > Looks good to me, but I'd like to leave this one on the list a little
> > longer to see if anyone else has comments.
> >
> Guess no comments!

This patch does not fix anything.

Yet, it might be considered as one that increases robustness, but with this applied the
goto
https://elixir.bootlin.com/linux/v6.8-rc3/source/drivers/iio/industrialio-core.c#L2007
can be amended, right?

--
With Best Regards,
Andy Shevchenko