Commit be789992 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/atrac3plusdec: add FF_CODEC_CAP_INIT_CLEANUP

Fixes: memleaks
Fixes: 18332/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3P_fuzzer-5655654374572032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent d6fea2ef
...@@ -174,7 +174,6 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx) ...@@ -174,7 +174,6 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx)
ctx->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); ctx->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!ctx->ch_units || !ctx->fdsp) { if (!ctx->ch_units || !ctx->fdsp) {
atrac3p_decode_close(avctx);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
...@@ -393,6 +392,7 @@ AVCodec ff_atrac3p_decoder = { ...@@ -393,6 +392,7 @@ AVCodec ff_atrac3p_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_ATRAC3P, .id = AV_CODEC_ID_ATRAC3P,
.capabilities = AV_CODEC_CAP_DR1, .capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(ATRAC3PContext), .priv_data_size = sizeof(ATRAC3PContext),
.init = atrac3p_decode_init, .init = atrac3p_decode_init,
.close = atrac3p_decode_close, .close = atrac3p_decode_close,
...@@ -405,6 +405,7 @@ AVCodec ff_atrac3pal_decoder = { ...@@ -405,6 +405,7 @@ AVCodec ff_atrac3pal_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_ATRAC3PAL, .id = AV_CODEC_ID_ATRAC3PAL,
.capabilities = AV_CODEC_CAP_DR1, .capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(ATRAC3PContext), .priv_data_size = sizeof(ATRAC3PContext),
.init = atrac3p_decode_init, .init = atrac3p_decode_init,
.close = atrac3p_decode_close, .close = atrac3p_decode_close,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment