From: Li Qiang Date: Mon, 19 Sep 2016 02:07:11 +0000 (-0700) Subject: virtio-gpu: fix memory leak in virtio_gpu_resource_create_2d X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cb3a0522b694cc5bb6424497b3f828ccd28fd1dd;p=qemu.git 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 Reviewed-by: Marc-André Lureau Message-id: 57df486e.8379240a.c3620.ff81@mx.google.com Signed-off-by: Gerd Hoffmann --- 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; }