From: Li Zhong Date: Wed, 18 Sep 2013 09:40:42 +0000 (+0000) Subject: xfsprogs: fix potential memory leak in repare/sb.c X-Git-Tag: v3.2.0-alpha2~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=70ee4153f4c998774adcee1e576d3c1f305b92d0;p=thirdparty%2Fxfsprogs-dev.git xfsprogs: fix potential memory leak in repare/sb.c 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 Reviewed-by: Mark Tinguely Signed-off-by: Rich Johnston --- diff --git a/repair/sb.c b/repair/sb.c index e2f59337e..aa550e391 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); }