mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 15:58:05 +02:00
frontends/va: Fix leaks when create_video_codec fails
Cc: mesa-stable Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40504>
This commit is contained in:
parent
5134d37e7d
commit
089cd9d88e
1 changed files with 8 additions and 5 deletions
|
|
@ -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