Skip to contentSkip to conversation

qcserial: fix a memory leak in qcprobe error path

PATCH New Axel Lin 1 participant 1 message Jun 21, 2010

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH v2 1/1 qcserial: fix a memory leak in qcprobe error path

This patch adds missing kfree(data) before return -ENODEV.

---
 drivers/usb/serial/qcserial.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/usb/serial/qcserial.c +3 -0
index 04bb759..93d72eb 100644
@@ -139,6 +139,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 					"Could not set interface, error %d\n",
 					retval);
 				retval = -ENODEV;
+				kfree(data);
 			}
 			return retval;
 		}
@@ -155,6 +156,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 					"Could not set interface, error %d\n",
 					retval);
 				retval = -ENODEV;
+				kfree(data);
 			}
 			return retval;
 		}
@@ -163,6 +165,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 	default:
 		dev_err(&serial->dev->dev,
 			"unknown number of interfaces: %d\n", nintf);
+		kfree(data);
 		return -ENODEV;
 	}
 
Signature · 1 line
1.5.4.3