Skip to contentSkip to conversation

media: dvb: Fix memory leak in af9005_identify_state

PATCH In review Navid Emamdoost 2 participants 2 messages Oct 27, 2019 – Oct 28, 2019 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: dvb: Fix memory leak in af9005_identify_state

In the implementation of af9005_identify_state() there is a memory leak when checking the reply of af9005_boot_packet(). Go to error path to release buf.

Fixes af4e067e1dcf ("V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech")
---
 drivers/media/usb/dvb-usb/af9005.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/af9005.c +4 -2
index 02697d86e8c1..cfaf630be4d8 100644
@@ -975,8 +975,10 @@ static int af9005_identify_state(struct usb_device *udev,
 		*cold = 1;
 	else if (reply == 0x02)
 		*cold = 0;
-	else
-		return -EIO;
+	else {
+		ret = -EIO;
+		goto err;
+	}
 	deb_info("Identify state cold = %d\n", *cold);
 
 err:
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Navid Emamdoost

In the implementation of af9005_identify_state() there is a memory leak when checking the reply of af9005_boot_packet(). Go to error path to release buf.

Fixes af4e067e1dcf ("V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech")

Thank you for the patch.

Unfortunately a similar patch is already merged:

https://git.linuxtv.org/media_tree.git/commit/?id=2289adbfa559050d2a38bcd9caac1c18b800e928

Sean

Quoted 23 lines
---
 drivers/media/usb/dvb-usb/af9005.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/af9005.c +4 -2
index 02697d86e8c1..cfaf630be4d8 100644
@@ -975,8 +975,10 @@ static int af9005_identify_state(struct usb_device *udev,
 		*cold = 1;
 	else if (reply == 0x02)
 		*cold = 0;
-	else
-		return -EIO;
+	else {
+		ret = -EIO;
+		goto err;
+	}
 	deb_info("Identify state cold = %d\n", *cold);
 
 err:
Signature · 1 line
2.17.1