[FFmpeg-devel] [PATCH 189/217] avcodec/sanm: Cleanup generically on init failure

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Wed Dec 2 06:22:16 EET 2020


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/sanm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 9c11600b76..599ecc3737 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -470,10 +470,8 @@ static av_cold int init_buffers(SANMVideoContext *ctx)
                               &ctx->stored_frame_size, ctx->buf_size);
 
     if (!ctx->frm0 || !ctx->frm1 || !ctx->frm2 ||
-        (!ctx->stored_frame && !ctx->version)) {
-        destroy_buffers(ctx);
+        (!ctx->stored_frame && !ctx->version))
         return AVERROR(ENOMEM);
-    }
 
     return 0;
 }
@@ -1525,5 +1523,5 @@ AVCodec ff_sanm_decoder = {
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };
-- 
2.25.1



More information about the ffmpeg-devel mailing list