diff mbox series

[FFmpeg-devel,2/2] avcodec/cuviddec: unref output frame on failure

Message ID 20201213185104.6352-2-jamrial@gmail.com
State Accepted
Commit cd821c18dc8bc5949f4b4d13f07157928ae22bba
Headers show
Series [FFmpeg-devel,1/2] avcodec/cuviddec: check for av_buffer_ref() failure | expand

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

James Almer Dec. 13, 2020, 6:51 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cuviddec.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Philip Langdale Dec. 13, 2020, 11:44 p.m. UTC | #1
On Sun, 13 Dec 2020 15:51:04 -0300
James Almer <jamrial@gmail.com> wrote:

> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/cuviddec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
> index 331851231f..49775b5a09 100644
> --- a/libavcodec/cuviddec.c
> +++ b/libavcodec/cuviddec.c
> @@ -634,6 +634,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>      }
>  
>  error:
> +    if (ret < 0)
> +        av_frame_unref(frame);
> +
>      if (mapped_frame)
>          eret =
> CHECK_CU(ctx->cvdl->cuvidUnmapVideoFrame(ctx->cudecoder,
> mapped_frame)); 

LGTM


--phil
diff mbox series

Patch

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 331851231f..49775b5a09 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -634,6 +634,9 @@  FF_ENABLE_DEPRECATION_WARNINGS
     }
 
 error:
+    if (ret < 0)
+        av_frame_unref(frame);
+
     if (mapped_frame)
         eret = CHECK_CU(ctx->cvdl->cuvidUnmapVideoFrame(ctx->cudecoder, mapped_frame));