Skip to content

Commit

Permalink
virtio-gpu: fix memory leak in virtio_gpu_resource_create_2d
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li Qiang authored and kraxel committed Oct 26, 2016
1 parent ede0cbe commit cb3a052
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hw/display/virtio-gpu.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit cb3a052

Please sign in to comment.