diff options
author | Thomas Guillem <thomas@gllm.fr> | 2018-06-11 16:21:17 +0200 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2018-06-18 11:48:05 -0700 |
commit | ce2330bdf896458131fcd00f9284c31617adcf01 (patch) | |
tree | a16ca66518ba2bfd225fec243a1633ba8700e291 /libavcodec | |
parent | e85c608a46445e3e491811630e33690c30591662 (diff) | |
download | ffmpeg-streaming-ce2330bdf896458131fcd00f9284c31617adcf01.zip ffmpeg-streaming-ce2330bdf896458131fcd00f9284c31617adcf01.tar.gz |
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>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/videotoolboxenc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 7796a68..9f2a71b 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -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; |