mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
frontends/va: Fix leaks when create_video_codec fails
Cc: mesa-stable
Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
(cherry picked from commit 089cd9d88e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
parent
9c88f72f8c
commit
f1b6e15252
2 changed files with 9 additions and 6 deletions
|
|
@ -5294,7 +5294,7 @@
|
|||
"description": "frontends/va: Fix leaks when create_video_codec fails",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -430,18 +430,21 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width,
|
|||
context->surfaces = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal);
|
||||
context->buffers = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal);
|
||||
|
||||
mtx_lock(&drv->mutex);
|
||||
*context_id = handle_table_add(drv->htab, context);
|
||||
mtx_unlock(&drv->mutex);
|
||||
|
||||
if (create_decoder) {
|
||||
mtx_lock(&drv->mutex);
|
||||
context->decoder = drv->pipe->create_video_codec(drv->pipe, &context->templat);
|
||||
mtx_unlock(&drv->mutex);
|
||||
if (!context->decoder)
|
||||
if (!context->decoder) {
|
||||
vlVaDestroyContext(ctx, *context_id);
|
||||
*context_id = VA_INVALID_ID;
|
||||
return VA_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
mtx_lock(&drv->mutex);
|
||||
*context_id = handle_table_add(drv->htab, context);
|
||||
mtx_unlock(&drv->mutex);
|
||||
|
||||
return VA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue