Message ID | AM7PR03MB66608E5BAC4632BCDBC316608F2D9@AM7PR03MB6660.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | f200424fbf78ecbbf88cce6b0b0b6c2bedd8afab |
Headers | show |
Series | [FFmpeg-devel] avcodec/tta: Cleanup generically on init failure | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
Andreas Rheinhardt: > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/tta.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/tta.c b/libavcodec/tta.c > index 17b4ca9032..accac38893 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; > } > @@ -427,5 +425,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, > }; Will apply this later tonight unless there are objections. - Andreas
diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 17b4ca9032..accac38893 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; } @@ -427,5 +425,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, };
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/tta.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)