aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-06-04 12:37:14 +0200
committerGerd Hoffmann <kraxel@redhat.com>2021-06-15 07:16:25 +0200
commit25b2ef2e8ee23109b0c3ce9ea71330bf8a7d12bd (patch)
tree8f62e8deead182314f100e269e851aadeb47d479
parent05ece98f965997649b8d922d224240459bcc1403 (diff)
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>
-rw-r--r--contrib/vhost-user-gpu/vhost-user-gpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
index 6dc6a44f4e..611360e6b4 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;
}