public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: fix buffer leak in xlog_print_find_oldest
@ 2013-08-01  1:42 Eric Sandeen
  2013-08-01 14:21 ` Mark Tinguely
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2013-08-01  1:42 UTC (permalink / raw)
  To: 'linux-xfs@oss.sgi.com'

The error path in this function did not free the buffer
before returning.

Coverity found this one.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c
index dfd76b7..d0c2959 100644
--- a/logprint/log_print_all.c
+++ b/logprint/log_print_all.c
@@ -29,7 +29,7 @@ xlog_print_find_oldest(
 	xfs_buf_t	*bp;
 	xfs_daddr_t	first_blk;
 	uint		first_half_cycle, last_half_cycle;
-	int		error;
+	int		error = 0;
 
 	if (xlog_find_zeroed(log, &first_blk))
 		return 0;
@@ -43,17 +43,14 @@ xlog_print_find_oldest(
 	last_half_cycle = xlog_get_cycle(XFS_BUF_PTR(bp));
 	ASSERT(last_half_cycle != 0);
 
-	if (first_half_cycle == last_half_cycle) { /* all cycle nos are same */
+	if (first_half_cycle == last_half_cycle) /* all cycle nos are same */
 		*last_blk = 0;
-	} else {		/* have 1st and last; look for middle cycle */
+	else		/* have 1st and last; look for middle cycle */
 		error = xlog_find_cycle_start(log, bp, first_blk,
 					      last_blk, last_half_cycle);
-		if (error)
-			return error;
-	}
 
 	xlog_put_bp(bp);
-	return 0;
+	return error;
 }
 
 void


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

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

* Re: [PATCH] xfsprogs: fix buffer leak in xlog_print_find_oldest
  2013-08-01  1:42 [PATCH] xfsprogs: fix buffer leak in xlog_print_find_oldest Eric Sandeen
@ 2013-08-01 14:21 ` Mark Tinguely
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Tinguely @ 2013-08-01 14:21 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: 'linux-xfs@oss.sgi.com'

On 07/31/13 20:42, Eric Sandeen wrote:
> The error path in this function did not free the buffer
> before returning.
>
> Coverity found this one.
>
> Signed-off-by: Eric Sandeen<sandeen@redhat.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] 2+ messages in thread

end of thread, other threads:[~2013-08-01 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-01  1:42 [PATCH] xfsprogs: fix buffer leak in xlog_print_find_oldest Eric Sandeen
2013-08-01 14:21 ` Mark Tinguely

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