Messages in this thread | | | From | Ondrej Zary <> | Subject | Re: [PATCH] pata_parport: fix possible memory leak | Date | Sat, 11 Mar 2023 22:11:57 +0100 |
| |
On Saturday 11 March 2023 21:23:25 Sergey Shtylyov wrote: > On 3/11/23 11:19 PM, Sergei Shtylyov wrote: > > >> When ida_alloc() fails, "pi" is not freed although the misleading > >> comment says otherwise. > >> Move the ida_alloc() call up so we really don't have to free it. > > Wait, but don't we still need to call kfree() in pi_init_one()?
If it fails at device_register, the dev.release is already set to pata_parport_dev_release which does the kfree(). put_device() should call it. If it fails later, device_unregister() should do it.
> >> Reported-by: kernel test robot <lkp@intel.com> > >> Reported-by: Dan Carpenter <error27@gmail.com> > >> Link: https://lore.kernel.org/r/202303111822.IHNchbkp-lkp@intel.com/ > >> Signed-off-by: Ondrej Zary <linux@zary.sk> > > > > Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> > > > > [...] > > MBR, Sergey >
-- Ondrej Zary
| |