Messages in this thread | | | Date | Fri, 17 Jun 2005 20:20:31 -0700 | From | randy_dunlap <> | Subject | Re: missing kfree in fs/ext3/balloc.c |
| |
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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |