]> Git Repo - qemu.git/commitdiff
vhost-user-gpu: reorder free calls.
authorGerd Hoffmann <[email protected]>
Fri, 4 Jun 2021 10:37:14 +0000 (12:37 +0200)
committerGerd Hoffmann <[email protected]>
Tue, 15 Jun 2021 05:16:25 +0000 (07:16 +0200)
Free in correct order to avoid use-after-free.

Resolves: CID 1453812
Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Li Qiang <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20210604103714.1237414[email protected]>

contrib/vhost-user-gpu/vhost-user-gpu.c

index 6dc6a44f4e263bfb31ba9ba6ff32a6ab6e08e761..611360e6b4751cb56f04045d20016cbf7f099ec3 100644 (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;
     }
This page took 0.024557 seconds and 4 git commands to generate.