summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-05-25 11:07:42 -0300
committerJames Almer <jamrial@gmail.com>2017-09-06 11:35:14 -0300
commite49338a9c062df7f3167433d81a1528a978fd547 (patch)
treeacb9abd18b31d31b31d94fdb63b9a65755ca7072 /libavcodec
parent7273e234dee5dfeee67cc365a8f7fa0b8211127c (diff)
avcodec/audiotoolboxdec: add FF_CODEC_CAP_INIT_CLEANUP to the decoder capabilities
Extradata may be allocated and the AudioConverterRef may be created during init(), which in case of a failure would not be freed as close() isn't called afterwards. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/audiotoolboxdec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index d499a0afc8..c30817778f 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -599,7 +599,8 @@ static av_cold void ffat_decode_flush(AVCodecContext *avctx)
static av_cold int ffat_close_decoder(AVCodecContext *avctx)
{
ATDecodeContext *at = avctx->priv_data;
- AudioConverterDispose(at->converter);
+ if (at->converter)
+ AudioConverterDispose(at->converter);
av_bsf_free(&at->bsf);
av_packet_unref(&at->new_in_pkt);
av_packet_unref(&at->in_pkt);
@@ -628,7 +629,7 @@ static av_cold int ffat_close_decoder(AVCodecContext *avctx)
.flush = ffat_decode_flush, \
.priv_class = &ffat_##NAME##_dec_class, \
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, \
- .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, \
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, \
};
FFAT_DEC(aac, AV_CODEC_ID_AAC)