gfs2-utils: master - gfs2_edit: Fix memory leak in find_journal_block

Andrew Price andyp at fedoraproject.org
Fri Jan 6 15:27:38 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e3a51f9addfa5443d8570d6ccdfbd67ecd9b4d6b
Commit:        e3a51f9addfa5443d8570d6ccdfbd67ecd9b4d6b
Parent:        fef703bd67ef15e77d8aed68f9a1874c786ab134
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Fri Jan 6 13:23:58 2012 +0000
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Fri Jan 6 13:23:58 2012 +0000

gfs2_edit: Fix memory leak in find_journal_block

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

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

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 1deb374..f58657b 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -1521,6 +1521,7 @@ static uint64_t find_journal_block(const char *journal, uint64_t *j_size)
 			jblock = ji.ji_addr;
 			*j_size = ji.ji_nsegment * 0x10;
 		}
+		inode_put(&jiinode);
 	} else {
 		struct gfs2_dinode jdi;
 


More information about the cluster-commits mailing list