Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Cluster Development (http://www.linux-archive.org/cluster-development/)
-   -   gfs2_edit: Fix resource leaks in display_extended() (http://www.linux-archive.org/cluster-development/618000-gfs2_edit-fix-resource-leaks-display_extended.html)

Andrew Price 01-06-2012 02:19 PM

gfs2_edit: Fix resource leaks in display_extended()
 
Spotted by coverity: Variable "tmp_inode" going out of scope leaks the
storage it points to.

Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/edit/extended.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 7fd770f..7c0ced5 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -669,30 +669,35 @@ int display_extended(void)
tmp_bh = bread(&sbd, masterblock("rindex"));
tmp_inode = inode_get(&sbd, tmp_bh);
parse_rindex(tmp_inode, FALSE);
+ inode_put(&tmp_inode);
brelse(tmp_bh);
}
else if (block_is_jindex()) {
tmp_bh = bread(&sbd, block);
tmp_inode = inode_get(&sbd, tmp_bh);
print_jindex(tmp_inode);
+ inode_put(&tmp_inode);
brelse(tmp_bh);
}
else if (block_is_inum_file()) {
tmp_bh = bread(&sbd, block);
tmp_inode = inode_get(&sbd, tmp_bh);
print_inum(tmp_inode);
+ inode_put(&tmp_inode);
brelse(tmp_bh);
}
else if (block_is_statfs_file()) {
tmp_bh = bread(&sbd, block);
tmp_inode = inode_get(&sbd, tmp_bh);
print_statfs(tmp_inode);
+ inode_put(&tmp_inode);
brelse(tmp_bh);
}
else if (block_is_quota_file()) {
tmp_bh = bread(&sbd, block);
tmp_inode = inode_get(&sbd, tmp_bh);
print_quota(tmp_inode);
+ inode_put(&tmp_inode);
brelse(tmp_bh);
}
return 0;
--
1.7.6.4


All times are GMT. The time now is 12:49 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.