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

Andrew Price andyp at fedoraproject.org
Tue Apr 7 21:22:16 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=e2ee1e897df004e2843be27f10af3a30ecb59d5d
Commit:        e2ee1e897df004e2843be27f10af3a30ecb59d5d
Parent:        e1af32506a4e616d09d075901abe47684b7d9719
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Thu Sep 18 13:50:58 2014 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Wed Apr 1 16:51:34 2015 +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 40c80b9..3c10fef 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -1990,6 +1990,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 (astate_changed(ip, &as)) {


More information about the cluster-commits mailing list