cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 09/11] gfs2_edit: Fix resource leaks in display_extended()
Date: Fri,  6 Jan 2012 15:19:28 +0000	[thread overview]
Message-ID: <1325863170-32530-9-git-send-email-anprice@redhat.com> (raw)
In-Reply-To: <1325863170-32530-1-git-send-email-anprice@redhat.com>

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



  parent reply	other threads:[~2012-01-06 15:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06 15:19 [Cluster-devel] [PATCH 01/11] gfs2_edit: Remove a useless assignment Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 02/11] gfs2_edit: Check return value of compute_constants Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 03/11] gfs2_edit: Fix possible uninitialized access Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 04/11] gfs2_edit: Fix memory leak in dump_journal() Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 05/11] gfs2_edit: Fix null pointer dereference in dump_journal Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 06/11] gfs2_edit: Remove unused j_inode from find_journal_block() Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 07/11] gfs2_edit: Fix memory leak in find_journal_block Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 08/11] gfs2_edit: Check for error value from gfs2_get_bitmap Andrew Price
2012-01-06 15:19 ` Andrew Price [this message]
2012-01-06 15:19 ` [Cluster-devel] [PATCH 10/11] gfs2_edit: Fix resource leak in print_block_details() Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 11/11] gfs2_edit: Fix null pointer derefs in display_block_type() Andrew Price
2012-01-06 15:24   ` Steven Whitehouse

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=1325863170-32530-9-git-send-email-anprice@redhat.com \
    --to=anprice@redhat.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;
as well as URLs for NNTP newsgroup(s).