Skip to content

Commit

Permalink
vhost-user-gpu: reorder free calls.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kraxel committed Jun 15, 2021
1 parent 05ece98 commit 25b2ef2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/vhost-user-gpu/vhost-user-gpu.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 25b2ef2

Please sign in to comment.