diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2020-08-27 05:38:45 +0800 |
---|---|---|
committer | Rick Kern <kernrj@gmail.com> | 2020-09-28 21:46:23 -0400 |
commit | d80d91d2135e416a0e50ac7127d95ac995f805f6 (patch) | |
tree | fd9b7d4e4a760edd1acb27d0b9e9f2ff2754b34e /libavcodec | |
parent | 419d2524a8239a8f00b4c1702c91065b259615a2 (diff) | |
download | ffmpeg-d80d91d2135e416a0e50ac7127d95ac995f805f6.tar.gz |
avcodec/videotoolboxenc: fix use after destroy
The lock is used in clear_frame_queue().
Signed-off-by: Rick Kern <kernrj@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/videotoolboxenc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 7c87b6865c..ea13845232 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -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; |