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-18-2012, 03:39 PM
Andrew Price
 
Default fsck.gfs2: Plug memory leak in check_system_dir()

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

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

diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 4201bb2..c530695 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -667,6 +667,7 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
filename_len))) {
log_err( _("Unable to zero name string
"));
stack;
+ free(filename);
return -1;
}
memcpy(filename, tmp_name, filename_len);
@@ -678,6 +679,7 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
if (error) {
log_err(_("Error adding directory %s: %s
"),
filename, strerror(errno));
+ free(filename);
return -errno;
}
if (cur_blks != sysinode->i_di.di_blocks)
--
1.7.7.5
 

Thread Tools




All times are GMT. The time now is 02:32 AM.

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