未验证 提交 880301bb 编写于 作者: C Colin Ian King 提交者: Konstantin Komarov

fs/ntfs3: Fix a memory leak on object opts

Currently a failed allocation on sbi->upcase will cause an exit via
the label free_sbi causing a memory leak on object opts. Fix this by
re-ordering the exit paths free_opts and free_sbi so that kfree's occur
in the reverse allocation order.

Addresses-Coverity: ("Resource leak")
Fixes: 27fac777 ("fs/ntfs3: Init spi more in init_fs_context than fill_super")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Reviewed-by: NKari Argillander <kari.argillander@gmail.com>
Signed-off-by: NKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
上级 a0fc05a3
......@@ -1393,10 +1393,10 @@ static int ntfs_init_fs_context(struct fs_context *fc)
fc->ops = &ntfs_context_ops;
return 0;
free_opts:
kfree(opts);
free_sbi:
kfree(sbi);
free_opts:
kfree(opts);
return -ENOMEM;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册