[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20090615152829.3915.23655.stgit@t61.ukuu.org.uk>
Date: Mon, 15 Jun 2009 16:28:29 +0100
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: [PATCH] tty: Fix leaks introduced by the shift to separate ldisc
objects
From: Alan Cox <alan@...ux.intel.com>
Gold star for the kmemleak detector.
Signed-off-by: Alan Cox <alan@...ux.intel.com>
---
drivers/char/tty_ldisc.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 39c8f86..94b3e06 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -148,8 +148,10 @@ static struct tty_ldisc *tty_ldisc_try_get(int disc)
}
}
spin_unlock_irqrestore(&tty_ldisc_lock, flags);
- if (err)
+ if (err) {
+ kfree(ld);
return ERR_PTR(err);
+ }
return ld;
}
@@ -262,7 +264,7 @@ const struct file_operations tty_ldiscs_proc_fops = {
* @ld: line discipline
*
* Install an instance of a line discipline into a tty structure. The
- * ldisc must have a reference count above zero to ensure it remains/
+ * ldisc must have a reference count above zero to ensure it remains.
* The tty instance refcount starts at zero.
*
* Locking:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists