lkml.org 
[lkml]   [2019]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] media: usb: fix memory leak in af9005_identify_state
Hi Hans,

On Wed, Oct 9, 2019 at 7:42 AM Hans Verkuil <hverkuil@xs4all.nl> wrote:
>
> On 9/14/19 1:55 AM, Navid Emamdoost wrote:
> > In af9005_identify_state when returning -EIO the allocated buffer should
> > be released.
> >
> > Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> > ---
> > drivers/media/usb/dvb-usb/af9005.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
> > index 02697d86e8c1..aee500beaab6 100644
> > --- a/drivers/media/usb/dvb-usb/af9005.c
> > +++ b/drivers/media/usb/dvb-usb/af9005.c
> > @@ -975,8 +975,10 @@ static int af9005_identify_state(struct usb_device *udev,
> > *cold = 1;
> > else if (reply == 0x02)
> > *cold = 0;
> > - else
> > + else {
> > + kfree(buf);
> > return -EIO;
> > + }
>
> Why not just set ret = -EIO; here?
>
This makes sense. I will send a v2.

> You only need to add a
>
> if (!ret)
> > deb_info("Identify state cold = %d\n", *cold);
>
> before this line.
>
> So this becomes:
>
> else
> ret = -EIO;
> if (!ret)
> deb_info("Identify state cold = %d\n", *cold);
>
> Regards,
>
> Hans
>
> >
> > err:
> >
>


--
Navid.

\
 
 \ /
  Last update: 2019-10-09 17:02    [W:0.035 / U:0.244 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site