]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: fix potential memory leak in repare/sb.c
authorLi Zhong <zhong@linux.vnet.ibm.com>
Wed, 18 Sep 2013 09:40:42 +0000 (09:40 +0000)
committerRich Johnston <rjohnston@sgi.com>
Thu, 17 Oct 2013 18:53:02 +0000 (13:53 -0500)
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@linux.vnet.ibm.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
repair/sb.c

index e2f59337e30519e856c1744f75adb30a996680cb..aa550e3913b4d7e291a21e7720b2c1ea85213f42 100644 (file)
@@ -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);
        }