diff mbox series

[FFmpeg-devel,03/13] avcodec/interplayvideo: Cleanup generically after init failure

Message ID 20200829175626.11682-3-andreas.rheinhardt@gmail.com
State Accepted
Commit 35b478de5b7bb885fd61b339c97f20471148e166
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/interplayvideo.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Paul B Mahol Aug. 29, 2020, 6:08 p.m. UTC | #1
On 8/29/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/interplayvideo.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
>

LGTM
diff mbox series

Patch

diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index 274641c3d1..58400b6ace 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -1160,7 +1160,6 @@  static void ipvideo_decode_format_11_opcodes(IpvideoContext *s, AVFrame *frame)
 static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
 {
     IpvideoContext *s = avctx->priv_data;
-    int ret;
 
     s->avctx = avctx;
 
@@ -1175,8 +1174,7 @@  static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
     s->prev_decode_frame = av_frame_alloc();
     if (!s->last_frame || !s->second_last_frame ||
         !s->cur_decode_frame || !s->prev_decode_frame) {
-        ret = AVERROR(ENOMEM);
-        goto error;
+        return AVERROR(ENOMEM);
     }
 
     s->cur_decode_frame->width   = avctx->width;
@@ -1187,12 +1185,6 @@  static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
     s->prev_decode_frame->format = avctx->pix_fmt;
 
     return 0;
-error:
-    av_frame_free(&s->last_frame);
-    av_frame_free(&s->second_last_frame);
-    av_frame_free(&s->cur_decode_frame);
-    av_frame_free(&s->prev_decode_frame);
-    return ret;
 }
 
 static int ipvideo_decode_frame(AVCodecContext *avctx,
@@ -1381,4 +1373,5 @@  AVCodec ff_interplay_video_decoder = {
     .close          = ipvideo_decode_end,
     .decode         = ipvideo_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_PARAM_CHANGE,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };