Commit d3b2bab7 authored by Jean-Paul Saman's avatar Jean-Paul Saman

VAAPI: fix possible deadlock

The cleanup routines in CreateDecodingContext() allowed for a deadlock to occur when the creation of surfaces failed early.
parent 229dc368
...@@ -252,14 +252,18 @@ static int CreateDecodingContext( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fo ...@@ -252,14 +252,18 @@ static int CreateDecodingContext( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fo
if( pi_surface_id == NULL ) if( pi_surface_id == NULL )
{ {
p_va->i_surface_count = 0; p_va->i_surface_count = 0;
goto error; p_va->conn->unlock();
return VLC_EGENERIC;
} }
/* */ /* */
p_va->i_surface_count = p_va->conn->i_surface_count; p_va->i_surface_count = p_va->conn->i_surface_count;
p_va->p_surface = calloc( p_va->i_surface_count, sizeof(*p_va->p_surface) ); p_va->p_surface = calloc( p_va->i_surface_count, sizeof(*p_va->p_surface) );
if( !p_va->p_surface ) if( !p_va->p_surface )
{
p_va->conn->unlock();
return VLC_EGENERIC; return VLC_EGENERIC;
}
p_va->image.image_id = VA_INVALID_ID; p_va->image.image_id = VA_INVALID_ID;
p_va->i_context_id = VA_INVALID_ID; p_va->i_context_id = VA_INVALID_ID;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment