vhost-user-gpu: reorder free calls.

Free in correct order to avoid use-after-free.

Resolves: CID 1453812
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210604103714.1237414-1-kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2021-06-04 12:37:14 +02:00
parent 05ece98f96
commit 25b2ef2e8e
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}