Skip to contentSkip to conversation

virtio-gpu: fix memory leak in virtio_gpu_resource_create_2d

PATCH In review Li Qiang 3 participants 3 messages Sep 19, 2016 – Oct 26, 2016

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 virtio-gpu: fix memory leak in virtio_gpu_resource_create_2d

From: Li Qiang <[email protected]>

In virtio gpu resource create dispatch, if the pixman format is zero it doesn't free the resource object allocated previously. Thus leading a host memory leak issue. This patch avoid this.

---
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-gpu.c +1 -0
index 7fe6ed8..5b6d17b 100644
@@ -333,6 +333,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: host couldn't handle guest format %d\n",
                       __func__, c2d.format);
+        g_free(res);
         cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
         return;
     }
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Li Qiang

From: Li Qiang <[email protected]>

In virtio gpu resource create dispatch, if the pixman format is zero it doesn't free the resource object allocated previously. Thus leading a host memory leak issue. This patch avoid this.

---

Quoted 19 lines
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-gpu.c +1 -1
index 7fe6ed8..5b6d17b 100644
@@ -333,6 +333,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: host couldn't handle guest format %d\n",
                       __func__, c2d.format);
+        g_free(res);
         cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
         return;
     }
--

1.8.3.1

Quoted 1 line

--

Marc-André Lureau