]> Git Repo - qemu.git/commitdiff
virtio-gpu: fix memory leak in resource attach backing
authorLi Qiang <[email protected]>
Thu, 29 Dec 2016 09:28:41 +0000 (04:28 -0500)
committerGerd Hoffmann <[email protected]>
Tue, 3 Jan 2017 14:47:21 +0000 (15:47 +0100)
In the resource attach backing function, everytime it will
allocate 'res->iov' thus can leading a memory leak. This
patch avoid this.

Signed-off-by: Li Qiang <[email protected]>
Message-id: 1483003721[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
hw/display/virtio-gpu.c

index 6a26258cac82983ce49dc6f557a6655d32df382d..ca88cf478daf56be433a28fd1e0faa4c0b2bcc75 100644 (file)
@@ -714,6 +714,11 @@ virtio_gpu_resource_attach_backing(VirtIOGPU *g,
         return;
     }
 
+    if (res->iov) {
+        cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
+        return;
+    }
+
     ret = virtio_gpu_create_mapping_iov(&ab, cmd, &res->addrs, &res->iov);
     if (ret != 0) {
         cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
This page took 0.02817 seconds and 4 git commands to generate.