From 25b2ef2e8ee23109b0c3ce9ea71330bf8a7d12bd Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 4 Jun 2021 12:37:14 +0200 Subject: vhost-user-gpu: reorder free calls. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Free in correct order to avoid use-after-free. Resolves: CID 1453812 Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Reviewed-by: Li Qiang Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210604103714.1237414-1-kraxel@redhat.com> --- contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/vhost-user-gpu') diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c index 6dc6a44..611360e 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g, if (!res->image) { g_critical("%s: resource creation failed %d %d %d", __func__, c2d.resource_id, c2d.width, c2d.height); - g_free(res); vugbm_buffer_destroy(&res->buffer); + g_free(res); cmd->error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY; return; } -- cgit v1.1