FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-20-2012, 11:39 AM
Andrew Price
 
Default fsck.gfs2: Plug a leak in peruse_system_dinode()

Spotted by coverity: Variable "ip" going out of scope leaks the storage
it points to.

If one of the if/else conditions is true, ip is stored in a global
variable or freed, so the leak happens when none of them are true. To
fix this I've added an else statement to free ip and moved the
out_discard_ip label into it to avoid duplicating the inode_put().

Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/fsck/initialize.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 3daf12d..f07e0b2 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -911,11 +911,10 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di,
fix_md.qinode = ip;
log_warn(_("Found system quota file at: 0x%llx
"),
di->di_num.no_addr);
- }
- return;
-
+ } else {
out_discard_ip:
- inode_put(&ip);
+ inode_put(&ip);
+ }
}

/**
--
1.7.7.5
 

Thread Tools




All times are GMT. The time now is 09:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org