From: Brian Gerst <bgerst@quark.didntduck.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] mem leak in tty_io.c
Date: Sat, 23 Oct 2004 22:58:16 -0400 [thread overview]
Message-ID: <417B1A48.2000903@quark.didntduck.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 223 bytes --]
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
[-- Attachment #2: tty-kfree --]
[-- Type: text/plain, Size: 554 bytes --]
diff -urN linux-2.6.9-bk/drivers/char/tty_io.c linux/drivers/char/tty_io.c
--- linux-2.6.9-bk/drivers/char/tty_io.c 2004-10-22 09:53:21.373263820 -0400
+++ linux/drivers/char/tty_io.c 2004-10-22 10:36:10.753679871 -0400
@@ -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;
}
reply other threads:[~2004-10-24 2:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=417B1A48.2000903@quark.didntduck.org \
--to=bgerst@quark.didntduck.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®