[PATCH] xfsprogs: fix potential memory leak in repare/sb.c

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

 



Following Resource leak is reported by coverity:
  
CID 997011 (#1 of 1): Resource leak (RESOURCE_LEAK)6. leaked_storage:
Variable "buf" going out of scope leaks the storage it points to.
505                return(XR_EOF);

Add a free(buf) to solve it. 

Signed-off-by: Li Zhong <zhong@xxxxxxxxxxxxxxxxxx>
---
 repair/sb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/repair/sb.c b/repair/sb.c
index e2f5933..aa550e3 100644
--- a/repair/sb.c
+++ b/repair/sb.c
@@ -502,6 +502,7 @@ get_sb(xfs_sb_t *sbp, xfs_off_t off, int size, xfs_agnumber_t agno)
 		do_warn(
 	_("error reading superblock %u -- seek to offset %" PRId64 " failed\n"),
 			agno, off);
+		free(buf);
 		return(XR_EOF);
 	}
 



_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux