summary refs log tree commit diff stats
path: root/hw/display/virtio-gpu.c
diff options
context:
space:
mode:
authorLi Qiang <liqiang6-s@360.cn>2016-09-18 19:07:11 -0700
committerGerd Hoffmann <kraxel@redhat.com>2016-10-26 14:52:21 +0200
commitcb3a0522b694cc5bb6424497b3f828ccd28fd1dd (patch)
treed7952e08e976d874cac40fe699a818b4ed7126d9 /hw/display/virtio-gpu.c
parentede0cbeb7892bdf4a19128853a3a3c61a17fb068 (diff)
downloadfocaccia-qemu-cb3a0522b694cc5bb6424497b3f828ccd28fd1dd.tar.gz
focaccia-qemu-cb3a0522b694cc5bb6424497b3f828ccd28fd1dd.zip
virtio-gpu: fix memory leak in virtio_gpu_resource_create_2d
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.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 57df486e.8379240a.c3620.ff81@mx.google.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display/virtio-gpu.c')
-rw-r--r--hw/display/virtio-gpu.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index fa6fd0e53f..60bce94d6b 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -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;
     }