mem leak in tty_io.c
PATCH 1/1 mem leak in tty_io.c
The recent patch to clean up user accesses introduced a memory leak. If write_buf is reallocated, the old buffer isn't freed. Also, since kfree can take nulls, I removed the if from the other kfree.
--
Brian Gerst
drivers/char/tty_io.c +2 -2
@@ -168,8 +168,7 @@static inline void free_tty_struct (struct tty_struct *tty) { -if (tty->write_buf) -kfree (tty->write_buf); +kfree (tty->write_buf);kfree (tty); }
@@ -1060,6 +1059,7 @@up (&tty->atomic_write);return -ENOMEM ; } +kfree (tty->write_buf); tty->write_cnt = chunk; tty->write_buf = buf; }