1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/videotoolboxenc: fix use after destroy

The lock is used in clear_frame_queue().

Signed-off-by: Rick Kern <kernrj@gmail.com>
This commit is contained in:
Zhao Zhili 2020-08-27 05:38:45 +08:00 committed by Rick Kern
parent 419d2524a8
commit d80d91d213

View File

@ -2492,14 +2492,17 @@ 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;
if(!vtctx->session) {
pthread_cond_destroy(&vtctx->cv_sample_sent);
pthread_mutex_destroy(&vtctx->lock);
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;