diff mbox series

[FFmpeg-devel,06/13] avcodec/roqvideodec: Cleanup generically after init failure

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

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/roqvideodec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Paul B Mahol Aug. 29, 2020, 8:39 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/roqvideodec.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c
> index a0c293f2f0..dd045ed5eb 100644
> --- a/libavcodec/roqvideodec.c
> +++ b/libavcodec/roqvideodec.c
> @@ -184,11 +184,8 @@ static av_cold int roq_decode_init(AVCodecContext
> *avctx)
>
>      s->last_frame    = av_frame_alloc();
>      s->current_frame = av_frame_alloc();
> -    if (!s->current_frame || !s->last_frame) {
> -        av_frame_free(&s->current_frame);
> -        av_frame_free(&s->last_frame);
> +    if (!s->current_frame || !s->last_frame)
>          return AVERROR(ENOMEM);
> -    }
>
>      avctx->pix_fmt = AV_PIX_FMT_YUVJ444P;
>      avctx->color_range = AVCOL_RANGE_JPEG;
> @@ -248,4 +245,5 @@ AVCodec ff_roq_decoder = {
>      .close          = roq_decode_end,
>      .decode         = roq_decode_frame,
>      .capabilities   = AV_CODEC_CAP_DR1,
> +    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>  };
> --
> 2.20.1
>

LGTM

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c
index a0c293f2f0..dd045ed5eb 100644
--- a/libavcodec/roqvideodec.c
+++ b/libavcodec/roqvideodec.c
@@ -184,11 +184,8 @@  static av_cold int roq_decode_init(AVCodecContext *avctx)
 
     s->last_frame    = av_frame_alloc();
     s->current_frame = av_frame_alloc();
-    if (!s->current_frame || !s->last_frame) {
-        av_frame_free(&s->current_frame);
-        av_frame_free(&s->last_frame);
+    if (!s->current_frame || !s->last_frame)
         return AVERROR(ENOMEM);
-    }
 
     avctx->pix_fmt = AV_PIX_FMT_YUVJ444P;
     avctx->color_range = AVCOL_RANGE_JPEG;
@@ -248,4 +245,5 @@  AVCodec ff_roq_decoder = {
     .close          = roq_decode_end,
     .decode         = roq_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };