[PATCH][next] staging: media: atomisp: fix memory leak of object flash

Mauro Carvalho Chehab mchehab at kernel.org
Thu Sep 3 09:05:09 UTC 2020

Em Wed, 2 Sep 2020 21:15:31 +0300
Andy Shevchenko <andy.shevchenko at gmail.com> escreveu:

> On Wed, Sep 2, 2020 at 8:02 PM Colin King <colin.king at canonical.com> wrote:
> >
> > From: Colin Ian King <colin.king at canonical.com>
> >
> > In the case where the call to lm3554_platform_data_func returns an
> > error there is a memory leak on the error return path of object
> > flash.  Fix this by adding an error return path that will free
> > flash and rename labels fail2 to fail3 and fail1 to fail2.
> >  
> Wouldn't be proper fix to move to devm_kmalloc() and return
> dev_err_probe() where appropriate?

Actually, we prefer not using devm_*() at media subsystem.

Once we started migrating alloc stuff to use it. We end needing
to revert those, as it caused side effects related to lifecycle
management: some object were de-allocating too late. Others
with multiple interfaces (USB, pci) had even worse troubles.


More information about the devel mailing list