mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: randy_dunlap <rdunlap@xenotime.net>
To: movq movq <movq_64@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: missing kfree in fs/ext3/balloc.c
Date: Fri, 17 Jun 2005 20:20:31 -0700	[thread overview]
Message-ID: <20050617202031.28523e9b.rdunlap@xenotime.net> (raw)
In-Reply-To: <20050618025312.22719.qmail@web61215.mail.yahoo.com>

On Fri, 17 Jun 2005 19:53:12 -0700 (PDT) movq movq wrote:

| This is my first post, so be kind. Perhaps I am wrong
| here, but I was looking through fs/ext3/balloc.c and
| noticed this line:
| 
| line 268
| ...
| block_i = kmalloc(sizeof(*block_i), GFP_NOFS);
| ...
| 
| But I do not see this chunk of memory ever kfree()'d.
| Is there a reason for this or is this kfree() just
| missing?

It's not supposed to be freed in that function.
It is saved for later use at line 288:

	ei->i_block_alloc_info = block_i;

and freed (I think) in fs/ext3/super.c::ext3_clear_inode():

	EXT3_I(inode)->i_block_alloc_info = NULL;
	kfree(rsv);

where rsv is:
	struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info;


However, back to fs/ext3/balloc.c::ext3_init_block_alloc_info():

{
	struct ext3_inode_info *ei = EXT3_I(inode);
[1]	struct ext3_block_alloc_info *block_i = ei->i_block_alloc_info;
	struct super_block *sb = inode->i_sb;

[2]	block_i = kmalloc(sizeof(*block_i), GFP_NOFS);
	if (block_i) {

Seems to me that <block_i> [1] is clobbered by [2] and could be a
memory leak unless the value in [1] is always NULL....

---
~Randy

  reply	other threads:[~2005-06-18  3:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-18  2:53 movq movq
2005-06-18  3:20 ` randy_dunlap [this message]
2005-06-18  3:09 movq movq

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=20050617202031.28523e9b.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=movq_64@yahoo.com \
    /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®