Thread (5 messages) 5 messages, 4 authors, 2012-06-19

Re: [PATCH] drivers/tty/tty_io.c: fix a potential memleak at do_tty_write()

From: Jeff Liu <hidden>
Date: 2012-06-19 03:45:07

On 06/19/2012 02:00 AM, Paul Fulghum wrote:
On 6/18/2012 11:04 AM, Alan Cox wrote:
quoted
On Mon, 18 Jun 2012 20:23:54 +0800
Jeff Liu [off-list ref] wrote:
quoted
Hello,

Looks there is a potential memory leak at drivers/tty/tty_io.c: do_tty_write().
It did allocate a buf_chunk if tty->write_cnt < chunk, however, buf_chunk was not
freed after the writing is done.  Below tiny patch could fix it.
Why should it be freed, we still have a reference to it.
Yeah, it would be messy on the next write()
when the now freed tty->write_buf is accessed ;-)
*boom*
Oops! I took for granted previously. Duh. :(

Sorry for the noise!

-Jeff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help