diff mbox series

[FFmpeg-devel,02/13] avcodec/eacmv: Cleanup generically after init failure

Message ID 20200829175626.11682-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 3c7ca68eeb8f121988a2fe8f36b1bae10e0c3ea1
Headers show
Series [FFmpeg-devel,01/13] avcodec/cinepakenc: Cleanup generically after init failure
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 29, 2020, 5:56 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/eacmv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index 6f39d72b88..b239acffda 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -50,11 +50,8 @@  static av_cold int cmv_decode_init(AVCodecContext *avctx){
 
     s->last_frame  = av_frame_alloc();
     s->last2_frame = av_frame_alloc();
-    if (!s->last_frame || !s->last2_frame) {
-        av_frame_free(&s->last_frame);
-        av_frame_free(&s->last2_frame);
+    if (!s->last_frame || !s->last2_frame)
         return AVERROR(ENOMEM);
-    }
 
     return 0;
 }
@@ -243,4 +240,5 @@  AVCodec ff_eacmv_decoder = {
     .close          = cmv_decode_end,
     .decode         = cmv_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };