gfs2-utils: master - fsck.gfs2: Fix memory leak in pass2

Andrew Price andyp at fedoraproject.org
Fri Sep 19 13:44:46 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=fb30e395e6e8a05246f37365f141bef22b73193e
Commit:        fb30e395e6e8a05246f37365f141bef22b73193e
Parent:        99ec0b8d3d26fc24e945ac515c001baf352b39ee
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Thu Sep 18 13:50:58 2014 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Thu Sep 18 13:50:58 2014 +0100

fsck.gfs2: Fix memory leak in pass2

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

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

diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 2971b8c..1559d8e 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -1988,6 +1988,7 @@ int pass2(struct gfs2_sbd *sdp)
 				if (error) {
 					log_err(_("Error adding directory %s: %s\n"), "'.'",
 					        strerror(errno));
+					fsck_inode_put(&ip);
 					return -errno;
 				}
 				if (cur_blks != ip->i_di.di_blocks) {


More information about the cluster-commits mailing list