Skip to contentSkip to conversation

ENXIO error case memory leak PTI fix.

PATCH New [email protected] 1 participant 1 message May 25, 2011 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ENXIO error case memory leak PTI fix.

From: J Freyensee <[email protected]>

This patch fixes a memory leak that can occur in the error case ENXIO is returned in the pti_tty_install() routine.

---
 drivers/misc/pti.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/misc/pti.c +3 -1
index be48573..e74e7d2 100644
@@ -476,8 +476,10 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty)
 		else
 			pti_tty_data->mc = pti_request_masterchannel(2);
 
-		if (pti_tty_data->mc == NULL)
+		if (pti_tty_data->mc == NULL) {
+			kfree(pti_tty_data);
 			return -ENXIO;
+		}
 		tty->driver_data = pti_tty_data;
 	}
 
Signature · 1 line
1.7.2.3