[FFmpeg-devel,3/5] avcodec/atrac3plusdec: add FF_CODEC_CAP_INIT_CLEANUP

Submitted by Michael Niedermayer on Oct. 19, 2019, 8:39 p.m.

Details

Message ID 20191019203950.11689-3-michael@niedermayer.cc
State Accepted
Commit be78999266cdf79ffd8b9a760e8d3bc1c9ae228b
Headers show

Commit Message

Michael Niedermayer Oct. 19, 2019, 8:39 p.m.
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/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/atrac3plusdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Nov. 9, 2019, 4:23 p.m.
On Sat, Oct 19, 2019 at 10:39:48PM +0200, Michael Niedermayer wrote:
> 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/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/atrac3plusdec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/atrac3plusdec.c b/libavcodec/atrac3plusdec.c
index 666d1a5c01..4b008ba0ee 100644
--- a/libavcodec/atrac3plusdec.c
+++ b/libavcodec/atrac3plusdec.c
@@ -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);
 
     if (!ctx->ch_units || !ctx->fdsp) {
-        atrac3p_decode_close(avctx);
         return AVERROR(ENOMEM);
     }
 
@@ -393,6 +392,7 @@  AVCodec ff_atrac3p_decoder = {
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = AV_CODEC_ID_ATRAC3P,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .priv_data_size = sizeof(ATRAC3PContext),
     .init           = atrac3p_decode_init,
     .close          = atrac3p_decode_close,
@@ -405,6 +405,7 @@  AVCodec ff_atrac3pal_decoder = {
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = AV_CODEC_ID_ATRAC3PAL,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .priv_data_size = sizeof(ATRAC3PContext),
     .init           = atrac3p_decode_init,
     .close          = atrac3p_decode_close,