diff mbox series

[FFmpeg-devel] avcodec/libvpxdec: Remove redundant unreferencing of AVFrame

Message ID AS8P250MB0744E1F14C68BC88947A9E128FFBA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 63eb630915b9ef92d21e521d610ed9d3ee2f358f
Headers show
Series [FFmpeg-devel] avcodec/libvpxdec: Remove redundant unreferencing of AVFrame | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 18, 2023, 12:41 p.m. UTC
The AVFrame of a decoder with the ordinary decode callback
is generically unreferenced on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/libvpxdec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

James Zern Sept. 18, 2023, 5:17 p.m. UTC | #1
On Mon, Sep 18, 2023 at 5:40 AM Andreas Rheinhardt
<andreas.rheinhardt@outlook.com> wrote:
>
> The AVFrame of a decoder with the ordinary decode callback
> is generically unreferenced on error.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/libvpxdec.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>

lgtm.

> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
> index 72ef5fa9a7..c6187fd5a1 100644
> --- a/libavcodec/libvpxdec.c
> +++ b/libavcodec/libvpxdec.c
> @@ -317,10 +317,8 @@ static int vpx_decode(AVCodecContext *avctx, AVFrame *picture,
>                  return AVERROR(ENOMEM);
>              if (ctx->has_alpha_channel) {
>                  picture->buf[1] = av_buffer_ref(img_alpha->fb_priv);
> -                if (!picture->buf[1]) {
> -                    av_frame_unref(picture);
> +                if (!picture->buf[1])
>                      return AVERROR(ENOMEM);
> -                }
>              }
>              for (int i = 0; i < 4; i++) {
>                  picture->data[i] = planes[i];
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 72ef5fa9a7..c6187fd5a1 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -317,10 +317,8 @@  static int vpx_decode(AVCodecContext *avctx, AVFrame *picture,
                 return AVERROR(ENOMEM);
             if (ctx->has_alpha_channel) {
                 picture->buf[1] = av_buffer_ref(img_alpha->fb_priv);
-                if (!picture->buf[1]) {
-                    av_frame_unref(picture);
+                if (!picture->buf[1])
                     return AVERROR(ENOMEM);
-                }
             }
             for (int i = 0; i < 4; i++) {
                 picture->data[i] = planes[i];