Skip to content

Commit 2289adb

Browse files
Navidemmchehab
authored andcommitted
media: usb: fix memory leak in af9005_identify_state
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>
1 parent 69e3235 commit 2289adb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: drivers/media/usb/dvb-usb/af9005.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -976,8 +976,9 @@ static int af9005_identify_state(struct usb_device *udev,
976976
else if (reply == 0x02)
977977
*cold = 0;
978978
else
979-
return -EIO;
980-
deb_info("Identify state cold = %d\n", *cold);
979+
ret = -EIO;
980+
if (!ret)
981+
deb_info("Identify state cold = %d\n", *cold);
981982

982983
err:
983984
kfree(buf);

0 commit comments

Comments
 (0)