Commit 30ea32ab authored by Li Qiang's avatar Li Qiang Committed by Alex Williamson

vfio/pci: Fix potential memory leak in vfio_msi_cap_len

Free allocated vdev->msi_perm in error path.
Signed-off-by: default avatarLi Qiang <liq3ea@gmail.com>
Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 6bf4ca7f
......@@ -1180,8 +1180,10 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos)
return -ENOMEM;
ret = init_pci_cap_msi_perm(vdev->msi_perm, len, flags);
if (ret)
if (ret) {
kfree(vdev->msi_perm);
return ret;
}
return len;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment