summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-06-15 16:28:29 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 11:24:00 -0700
commit46a50661fc95d4acf5e4c203f7889234238ce642 (patch)
treef8ee6dd359a1fe9f0fe4d3206224651e537addc1 /drivers/char
parentcbcb6d66af4c6169ce1c2d01a3ab345f04b8359d (diff)
tty: Fix leaks introduced by the shift to separate ldisc objects
Gold star for the kmemleak detector. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tty_ldisc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 39c8f86dedd..94b3e06d73e 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: