cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 1/5] fsck.gfs2: Plug memory leak in check_system_dir()
@ 2012-01-18 16:39 Andrew Price
  2012-01-18 16:39 ` [Cluster-devel] [PATCH 2/5] fsck.gfs2: Fix null pointer deref " Andrew Price
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andrew Price @ 2012-01-18 16:39 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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\n"));
 				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\n"),
 				        filename, strerror(errno));
+				free(filename);
 				return -errno;
 			}
 			if (cur_blks != sysinode->i_di.di_blocks)
-- 
1.7.7.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-18 16:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-18 16:39 [Cluster-devel] [PATCH 1/5] fsck.gfs2: Plug memory leak in check_system_dir() Andrew Price
2012-01-18 16:39 ` [Cluster-devel] [PATCH 2/5] fsck.gfs2: Fix null pointer deref " Andrew Price
2012-01-18 16:39 ` [Cluster-devel] [PATCH 3/5] fsck.gfs2: Plug a leak in find_block_ref() Andrew Price
2012-01-18 16:39 ` [Cluster-devel] [PATCH 4/5] fsck.gfs2: Remove unused hash.c, hash.h Andrew Price
2012-01-18 16:39 ` [Cluster-devel] [PATCH 5/5] mkfs.gfs2: Improve error messages Andrew Price
2012-01-18 16:48   ` Steven Whitehouse

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).