diff mbox series

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

Message ID 20201202042244.519127-55-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/45] avcodec/a64multienc: Fix memleak upon init failure
Related show

Checks

Context Check Description
andriy/x86 warning Failed to apply patch

Commit Message

Andreas Rheinhardt Dec. 2, 2020, 4:22 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/sanm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

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,
 };