aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-10-09 12:01:47 -0300
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-12-02 14:07:18 -0500
commitaea6f13d6eff0af6c2d72ce8d10002606c5fc405 (patch)
treeb797a08f0d8dbba82e27a1ea442ef6cd035cbbd1
parent19746d855926cc9b890a1afea82f647cf88a1e08 (diff)
downloadlinux-yocto-aea6f13d6eff0af6c2d72ce8d10002606c5fc405.tar.gz
linux-yocto-aea6f13d6eff0af6c2d72ce8d10002606c5fc405.tar.bz2
linux-yocto-aea6f13d6eff0af6c2d72ce8d10002606c5fc405.zip
media: usb: fix memory leak in af9005_identify_state
commit 2289adbfa559050d2a38bcd9caac1c18b800e928 upstream. 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: af4e067e1dcf ("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> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--drivers/media/usb/dvb-usb/af9005.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
index 02697d86e8c1..ac93e88d7038 100644
--- a/drivers/media/usb/dvb-usb/af9005.c
+++ b/drivers/media/usb/dvb-usb/af9005.c
@@ -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);