[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 09/11] 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]