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

[Cluster-devel] [PATCH 1/5] 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\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


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