On 2/27/2017 21:02, Hou Pengyang wrote:
> [fix: ae75f0ca76 f2fs: introduce free nid bitmap]
> Signed-off-by: Hou Pengyang <houpengy...@huawei.com>
> ---
>  fs/f2fs/node.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 6d43095..353c01d 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -2650,8 +2650,11 @@ int init_free_nid_cache(struct f2fs_sb_info *sbi)
>  
>       nm_i->nat_block_bitmap = f2fs_kvzalloc(nm_i->nat_blocks / 8,
>                                                               GFP_KERNEL);
> -     if (!nm_i->nat_block_bitmap)
> +     if (!nm_i->nat_block_bitmap) {
> +             kvfree(nm_i->free_nid_bitmap);
>               return -ENOMEM;
> +     }
> +
>       return 0;
>  }

If building node manager fail, destroy_node_manager will be called,
I think there isn't any memory leak exist, right?

        err = build_node_manager(sbi);
        if (err) {
                f2fs_msg(sb, KERN_ERR,
                        "Failed to initialize F2FS node manager");
                goto free_nm;
        }


thanks,
Kinglong Mee

------------------------------------------------------------------------------
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

Reply via email to