diff mbox

Btrfs: fix memory leak in replace_path

Message ID 1368780344-7157-1-git-send-email-bo.li.liu@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liu Bo May 17, 2013, 8:45 a.m. UTC
We need to unlock and free extent buffer before the return.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/relocation.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Stefan Behrens May 17, 2013, 8:52 a.m. UTC | #1
On Fri, 17 May 2013 16:45:44 +0800, Liu Bo wrote:
> We need to unlock and free extent buffer before the return.
> 
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
>  fs/btrfs/relocation.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 704a1b8..5c5b8bb 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -1773,7 +1773,7 @@ again:
>  			if (!eb || !extent_buffer_uptodate(eb)) {
>  				ret = (!eb) ? -ENOMEM : -EIO;
>  				free_extent_buffer(eb);
> -				return ret;
> +				break;
>  			}
>  			btrfs_tree_lock(eb);
>  			if (cow) {
> 

ELATE

5887f17 Btrfs: fix possible memory leak in replace_path()

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Liu Bo May 17, 2013, 9:34 a.m. UTC | #2
On Fri, May 17, 2013 at 10:52:16AM +0200, Stefan Behrens wrote:
> On Fri, 17 May 2013 16:45:44 +0800, Liu Bo wrote:
> > We need to unlock and free extent buffer before the return.
> > 
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > ---
> >  fs/btrfs/relocation.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> > index 704a1b8..5c5b8bb 100644
> > --- a/fs/btrfs/relocation.c
> > +++ b/fs/btrfs/relocation.c
> > @@ -1773,7 +1773,7 @@ again:
> >  			if (!eb || !extent_buffer_uptodate(eb)) {
> >  				ret = (!eb) ? -ENOMEM : -EIO;
> >  				free_extent_buffer(eb);
> > -				return ret;
> > +				break;
> >  			}
> >  			btrfs_tree_lock(eb);
> >  			if (cow) {
> > 
> 
> ELATE
> 
> 5887f17 Btrfs: fix possible memory leak in replace_path()
> 

oh, good catch :)

thanks,
liubo
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Liu Bo May 17, 2013, 9:36 a.m. UTC | #3
oops, please ignore this as there is already a same patch from Stefan.

Sorry for the trouble.

thanks,
liubo

On Fri, May 17, 2013 at 04:45:44PM +0800, Liu Bo wrote:
> We need to unlock and free extent buffer before the return.
> 
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
>  fs/btrfs/relocation.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 704a1b8..5c5b8bb 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -1773,7 +1773,7 @@ again:
>  			if (!eb || !extent_buffer_uptodate(eb)) {
>  				ret = (!eb) ? -ENOMEM : -EIO;
>  				free_extent_buffer(eb);
> -				return ret;
> +				break;
>  			}
>  			btrfs_tree_lock(eb);
>  			if (cow) {
> -- 
> 1.7.7.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 704a1b8..5c5b8bb 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1773,7 +1773,7 @@  again:
 			if (!eb || !extent_buffer_uptodate(eb)) {
 				ret = (!eb) ? -ENOMEM : -EIO;
 				free_extent_buffer(eb);
-				return ret;
+				break;
 			}
 			btrfs_tree_lock(eb);
 			if (cow) {