avcodec/videotoolboxenc: fix mutex/cond leak in error path
The leak could happen when the vtenc_create_encoder() function failed. Signed-off-by: Aman Gupta <aman@tmm1.net>
This commit is contained in:
parent
e85c608a46
commit
ce2330bdf8
1 changed files with 3 additions and 2 deletions
|
|
@ -2473,13 +2473,14 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
|
|||
{
|
||||
VTEncContext *vtctx = avctx->priv_data;
|
||||
|
||||
pthread_cond_destroy(&vtctx->cv_sample_sent);
|
||||
pthread_mutex_destroy(&vtctx->lock);
|
||||
|
||||
if(!vtctx->session) return 0;
|
||||
|
||||
VTCompressionSessionCompleteFrames(vtctx->session,
|
||||
kCMTimeIndefinite);
|
||||
clear_frame_queue(vtctx);
|
||||
pthread_cond_destroy(&vtctx->cv_sample_sent);
|
||||
pthread_mutex_destroy(&vtctx->lock);
|
||||
CFRelease(vtctx->session);
|
||||
vtctx->session = NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue