diff mbox series

[FFmpeg-devel,v2,037/162] avcodec/mimic: Cleanup generically upon init failure

Message ID 20201120072116.818090-38-andreas.rheinhardt@gmail.com
State Accepted
Commit 3066b243e96f2dfa3fd405b2b89a8e8574e398dc
Headers show
Series VLC, esp. init_vlc patches | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

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

Patch

diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 7a74b99086..6ceb5c9ae3 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -138,10 +138,8 @@  static av_cold int mimic_decode_init(AVCodecContext *avctx)
 
     for (i = 0; i < FF_ARRAY_ELEMS(ctx->frames); i++) {
         ctx->frames[i].f = av_frame_alloc();
-        if (!ctx->frames[i].f) {
-            mimic_decode_end(avctx);
+        if (!ctx->frames[i].f)
             return AVERROR(ENOMEM);
-        }
     }
 
     return 0;
@@ -443,5 +441,5 @@  AVCodec ff_mimic_decoder = {
     .decode                = mimic_decode_frame,
     .capabilities          = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
     .update_thread_context = ONLY_IF_THREADS_ENABLED(mimic_decode_update_thread_context),
-    .caps_internal         = FF_CODEC_CAP_ALLOCATE_PROGRESS,
+    .caps_internal         = FF_CODEC_CAP_ALLOCATE_PROGRESS | FF_CODEC_CAP_INIT_CLEANUP,
 };