Skip to content

Commit

Permalink
media: usb: fix memory leak in af9005_identify_state
Browse files Browse the repository at this point in the history
In af9005_identify_state when returning -EIO the allocated buffer should
be released. Replace the "return -EIO" with assignment into ret and move
deb_info() under a check.

Fixes: af4e067 ("V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
  • Loading branch information
Navidem authored and mchehab committed Oct 24, 2019
1 parent 69e3235 commit 2289adb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/media/usb/dvb-usb/af9005.c
Expand Up @@ -976,8 +976,9 @@ static int af9005_identify_state(struct usb_device *udev,
else if (reply == 0x02)
*cold = 0;
else
return -EIO;
deb_info("Identify state cold = %d\n", *cold);
ret = -EIO;
if (!ret)
deb_info("Identify state cold = %d\n", *cold);

err:
kfree(buf);
Expand Down

0 comments on commit 2289adb

Please sign in to comment.