提交 0af5160e 编写于 作者: C Colin Ian King 提交者: Alex Williamson

vfio/mdpy: Fix memory leak of object mdev_state->vconfig

In the case where the call to vfio_register_group_dev fails the error
return path kfree's mdev_state but not mdev_state->vconfig. Fix this
by kfree'ing mdev_state->vconfig before returning.

Addresses-Coverity: ("Resource leak")
Fixes: 437e4136 ("vfio/mdpy: Convert to use vfio_register_group_dev()")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210622183710.28954-1-colin.king@canonical.comSigned-off-by: NAlex Williamson <alex.williamson@redhat.com>
上级 c7396f2e
......@@ -261,6 +261,7 @@ static int mdpy_probe(struct mdev_device *mdev)
ret = vfio_register_group_dev(&mdev_state->vdev);
if (ret) {
kfree(mdev_state->vconfig);
kfree(mdev_state);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册