mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ENXIO error case memory leak PTI fix.
@ 2011-05-25 21:45 james_p_freyensee
  0 siblings, 0 replies; only message in thread
From: james_p_freyensee @ 2011-05-25 21:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, christophe.guerard, james_p_freyensee, rocher.jeremy

From: J Freyensee <james_p_freyensee@linux.intel.com>

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

Signed-off-by: J Freyensee <james_p_freyensee@linux.intel.com>
---
 drivers/misc/pti.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index be48573..e74e7d2 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -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;
 	}
 
-- 
1.7.2.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-25 21:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 21:45 [PATCH] ENXIO error case memory leak PTI fix james_p_freyensee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome