Re: [f2fs-dev] [PATCH] fsck.f2fs: do umount to free memory in out_err

2018-05-17 Thread Junling Zheng
Sorry, this patch has a bug:

If f2fs_do_mount fails in validate_super_block or get_valid_checkpoint,
then we should only free sbi->ckpt and sbi->raw_super :(

On 2018/5/17 15:57, Junling Zheng wrote:
> Call f2fs_do_umount to free memory in out_err branch.
> 
> Signed-off-by: Junling Zheng 
> ---
>  fsck/main.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fsck/main.c b/fsck/main.c
> index c4dd8b1..870f2d8 100644
> --- a/fsck/main.c
> +++ b/fsck/main.c
> @@ -844,9 +844,6 @@ retry:
>   return 0;
>  
>  out_err:
> - if (sbi->ckpt)
> - free(sbi->ckpt);
> - if (sbi->raw_super)
> - free(sbi->raw_super);
> + f2fs_do_umount(sbi);
>   return ret;
>  }
> 



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] fsck.f2fs: do umount to free memory in out_err

2018-05-17 Thread Junling Zheng
Call f2fs_do_umount to free memory in out_err branch.

Signed-off-by: Junling Zheng 
---
 fsck/main.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fsck/main.c b/fsck/main.c
index c4dd8b1..870f2d8 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -844,9 +844,6 @@ retry:
return 0;
 
 out_err:
-   if (sbi->ckpt)
-   free(sbi->ckpt);
-   if (sbi->raw_super)
-   free(sbi->raw_super);
+   f2fs_do_umount(sbi);
return ret;
 }
-- 
2.16.2


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel