diff mbox series

[FFmpeg-devel,150/217] avcodec/utvideoenc: Cleanup generically on init failure

Message ID 20201202042244.519127-16-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:21 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/utvideoenc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index eea685f600..5dbfed59a3 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -195,7 +195,6 @@  FF_ENABLE_DEPRECATION_WARNINGS
 
     if (!avctx->extradata) {
         av_log(avctx, AV_LOG_ERROR, "Could not allocate extradata.\n");
-        utvideo_encode_close(avctx);
         return AVERROR(ENOMEM);
     }
 
@@ -204,7 +203,6 @@  FF_ENABLE_DEPRECATION_WARNINGS
                                        AV_INPUT_BUFFER_PADDING_SIZE);
         if (!c->slice_buffer[i]) {
             av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 1.\n");
-            utvideo_encode_close(avctx);
             return AVERROR(ENOMEM);
         }
     }
@@ -701,5 +699,5 @@  AVCodec ff_utvideo_encoder = {
                           AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_YUV422P,
                           AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE
                       },
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };