public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: fix potential memory leak in repare/sb.c
@ 2013-09-18  9:40 Li Zhong
  2013-09-18 16:26 ` Mark Tinguely
  2013-10-18 16:35 ` Rich Johnston
  0 siblings, 2 replies; 3+ messages in thread
From: Li Zhong @ 2013-09-18  9:40 UTC (permalink / raw)
  To: xfsprogs; +Cc: Chandra Seetharaman

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>
---
 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@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfsprogs: fix potential memory leak in repare/sb.c
  2013-09-18  9:40 [PATCH] xfsprogs: fix potential memory leak in repare/sb.c Li Zhong
@ 2013-09-18 16:26 ` Mark Tinguely
  2013-10-18 16:35 ` Rich Johnston
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Tinguely @ 2013-09-18 16:26 UTC (permalink / raw)
  To: Li Zhong; +Cc: Chandra Seetharaman, xfsprogs

On 09/18/13 04:40, Li Zhong wrote:
> 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>
> ---

Looks good.

Reviewed-by: Mark Tinguely <tinguely@sgi.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfsprogs: fix potential memory leak in repare/sb.c
  2013-09-18  9:40 [PATCH] xfsprogs: fix potential memory leak in repare/sb.c Li Zhong
  2013-09-18 16:26 ` Mark Tinguely
@ 2013-10-18 16:35 ` Rich Johnston
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Johnston @ 2013-10-18 16:35 UTC (permalink / raw)
  To: Li Zhong, xfsprogs; +Cc: Chandra Seetharaman

This has been committed.

Thanks
--Rich

commit 70ee4153f4c998774adcee1e576d3c1f305b92d0
Author: Li Zhong <zhong@linux.vnet.ibm.com>
Date:   Wed Sep 18 09:40:42 2013 +0000

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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-18 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18  9:40 [PATCH] xfsprogs: fix potential memory leak in repare/sb.c Li Zhong
2013-09-18 16:26 ` Mark Tinguely
2013-10-18 16:35 ` Rich Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox