Skip to contentSkip to conversation

fsck.gfs2: Fix a potential memory leak in pass3

PATCH New Andrew Price 1 participant 2 messages May 10, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fsck.gfs2: Fix a potential memory leak in pass3

Coverity spotted an instance where pass3() breaks out of the loop without first freeing the inode.

---
 gfs2/fsck/pass3.c | 1 +
 1 file changed, 1 insertion(+)
gfs2/fsck/pass3.c +1 -0
index fbf8318..85d7e36 100644
@@ -267,6 +267,7 @@ int pass3(struct gfs2_sbd *sdp)
 					    " (y/n) "))) {
 					log_err( _("The block was not "
 						   "cleared\n"));
+					fsck_inode_put(&ip);
 					break;
 				}
 				log_warn( _("inode %lld (0x%llx) is now "
Signature · 1 line
2.4.11
#1 lore raw

PATCH 2/2 gfs2_edit savemeta: Fix use of uninitialized 'blk'

Fixes
"savemeta.c:737:14: warning: ?blk? may be used uninitialized in this function"

blk is never actually used uninitialized here but the compiler can't reason it out, so make it explicit to silence the warning.

---
 gfs2/edit/savemeta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
gfs2/edit/savemeta.c +1 -1
index 8510d77..db9a947 100644
@@ -712,7 +712,7 @@ static void get_journal_inode_blocks(void)
 static void save_allocated(struct rgrp_tree *rgd, struct metafd *mfd)
 {
 	int blktype;
-	uint64_t blk;
+	uint64_t blk = 0;
 	unsigned i, j, m;
 	uint64_t *ibuf = malloc(sbd.bsize * GFS2_NBBY * sizeof(uint64_t));
 
Signature · 1 line
2.4.11