Commit 5e8e3c4c authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

virtio-gpu: fix resource leak in virgl_cmd_resource_unref

When the guest sends VIRTIO_GPU_CMD_RESOURCE_UNREF without detaching the
backing storage beforehand (VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING)
we'll leak memory.

This patch fixes it for 3d mode, simliar to the 2d mode fix in commit

 virtio-gpu: call cleanup mapping function in resource destroy".
Reported-by: default avatar李强 <>
Signed-off-by: Gerd Hoffmann's avatarGerd Hoffmann <>
parent dd248ed7
......@@ -77,10 +77,18 @@ static void virgl_cmd_resource_unref(VirtIOGPU *g,
struct virtio_gpu_ctrl_command *cmd)
struct virtio_gpu_resource_unref unref;
struct iovec *res_iovs = NULL;
int num_iovs = 0;
if (res_iovs != NULL && num_iovs != 0) {
virtio_gpu_cleanup_mapping_iov(res_iovs, num_iovs);
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