diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-08 11:57:29 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-11 19:38:41 +0100 |
commit | f200424fbf78ecbbf88cce6b0b0b6c2bedd8afab (patch) | |
tree | 86be1f4a49822c901c8ab25c96c104de4f913a0b | |
parent | 7743933a6087529666f99138f933f52699ef81c1 (diff) |
avcodec/tta: Cleanup generically on init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/tta.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 7ffae3d0ba..ef5a2b42ac 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -114,10 +114,8 @@ static int allocate_buffers(AVCodecContext *avctx) } else s->decode_buffer = NULL; s->ch_ctx = av_malloc_array(avctx->channels, sizeof(*s->ch_ctx)); - if (!s->ch_ctx) { - av_freep(&s->decode_buffer); + if (!s->ch_ctx) return AVERROR(ENOMEM); - } return 0; } @@ -426,5 +424,5 @@ const AVCodec ff_tta_decoder = { .decode = tta_decode_frame, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_CHANNEL_CONF, .priv_class = &tta_decoder_class, - .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, }; |