diff mbox series

[FFmpeg-devel,24/25] avcodec/vmdvideo: Cleanup generically upon init failure

Message ID VI1PR0301MB2159B1F3D4DF830D463431118F589@VI1PR0301MB2159.eurprd03.prod.outlook.com
State Accepted
Commit b15fcdfe5c724f3e0a8b28e6b4f8c9ef0c3ad6fe
Headers show
Series [FFmpeg-devel,01/23] avcodec/ljpegenc: Mark encoder as init-threadsafe
Related show

Checks

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

Commit Message

Andreas Rheinhardt May 6, 2021, 5:29 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/vmdvideo.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/vmdvideo.c b/libavcodec/vmdvideo.c
index 15846919d8..ad88a43ae3 100644
--- a/libavcodec/vmdvideo.c
+++ b/libavcodec/vmdvideo.c
@@ -423,10 +423,8 @@  static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
     }
 
     s->prev_frame = av_frame_alloc();
-    if (!s->prev_frame) {
-        vmdvideo_decode_end(avctx);
+    if (!s->prev_frame)
         return AVERROR(ENOMEM);
-    }
 
     return 0;
 }
@@ -477,4 +475,5 @@  const AVCodec ff_vmdvideo_decoder = {
     .close          = vmdvideo_decode_end,
     .decode         = vmdvideo_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };