Commit 46a50661 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

tty: Fix leaks introduced by the shift to separate ldisc objects

Gold star for the kmemleak detector.
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cbcb6d66
...@@ -148,8 +148,10 @@ static struct tty_ldisc *tty_ldisc_try_get(int disc) ...@@ -148,8 +148,10 @@ static struct tty_ldisc *tty_ldisc_try_get(int disc)
} }
} }
spin_unlock_irqrestore(&tty_ldisc_lock, flags); spin_unlock_irqrestore(&tty_ldisc_lock, flags);
if (err) if (err) {
kfree(ld);
return ERR_PTR(err); return ERR_PTR(err);
}
return ld; return ld;
} }
...@@ -262,7 +264,7 @@ const struct file_operations tty_ldiscs_proc_fops = { ...@@ -262,7 +264,7 @@ const struct file_operations tty_ldiscs_proc_fops = {
* @ld: line discipline * @ld: line discipline
* *
* Install an instance of a line discipline into a tty structure. The * 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. * The tty instance refcount starts at zero.
* *
* Locking: * Locking:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment