Skip to contentSkip to conversation

Fix memory leak in sierra_release()

PATCH Lennart Sorensen 2 participants 3 messages Oct 23, 2012 – Oct 24, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I found a memory leak in sierra_release() (well sierra_probe() I guess) that looses 8 bytes each time the driver releases a device.

Here is the patch to fix it.

drivers/usb/serial/sierra.c +1 -0
index 01d882c..76ef95b 100644
@@ -959,6 +959,7 @@ static void sierra_release(struct usb_serial *serial)
 			continue;
 		kfree(portdata);
 	}
+	kfree(serial->private);
 }
 
 #ifdef CONFIG_PM
Signature · 1 line
Len Sorensen
#1 lore raw
Quoted 10 lines · Lennart Sorensen

I found a memory leak in sierra_release() (well sierra_probe() I guess) that looses 8 bytes each time the driver releases a device.

Here is the patch to fix it.

drivers/usb/serial/sierra.c +0 -0
index 01d882c..76ef95b 100644

drivers/usb/serial/sierra.c static void sierra_release(struct usb_serial *serial) · line 965

Quoted 7 lines
drivers/usb/serial/sierra.c +1 -0
@@ -959,6 +959,7 @@ static void sierra_release(struct usb_serial *serial)
 			continue;
 		kfree(portdata);
 	}
+	kfree(serial->private);
 }
 
 #ifdef CONFIG_PM

Looks sensible to me, but needs a signed-off-by and CC to linux-usb.

Bjørn

#2 lore raw
Quoted 18 lines · Bjørn Mork
Quoted 16 lines · Lennart Sorensen

I found a memory leak in sierra_release() (well sierra_probe() I guess) that looses 8 bytes each time the driver releases a device.

Here is the patch to fix it.

drivers/usb/serial/sierra.c +1 -0
index 01d882c..76ef95b 100644
@@ -959,6 +959,7 @@ static void sierra_release(struct usb_serial *serial)
 			continue;
 		kfree(portdata);
 	}
+	kfree(serial->private);
 }
 
Quoted 3 lines

drivers/usb/serial/sierra.c static void sierra_release(struct usb_serial *serial) · line 965

Quoted 1 line
drivers/usb/serial/sierra.c +0 -0
 #ifdef CONFIG_PM

Looks sensible to me, but needs a signed-off-by and CC to linux-usb.

Oh yeah. I shouldn't send patches at the end of the day.

I will try again.

Signature · 1 line
Len Sorensen