This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 688f68bffa8101e2f6e210b352d874dafa5c4ad3
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Wed Apr 8 18:26:40 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Fri May 1 23:59:06 2026 +0000

    avcodec/vaapi_av1: fix leak of ref frames on init failure
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavcodec/vaapi_av1.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index b8f5472c14..0e1b8c60e0 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -74,22 +74,32 @@ static int8_t vaapi_av1_get_bit_depth_idx(AVCodecContext 
*avctx)
     return bit_depth == 8 ? 0 : bit_depth == 10 ? 1 : 2;
 }
 
+static av_cold int vaapi_av1_decode_uninit(AVCodecContext *avctx);
+
 static av_cold int vaapi_av1_decode_init(AVCodecContext *avctx)
 {
     VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data;
 
+    int ret = ff_vaapi_decode_init(avctx);
+    if (ret < 0)
+        return ret;
+
     ctx->tmp_frame = av_frame_alloc();
-    if (!ctx->tmp_frame)
+    if (!ctx->tmp_frame) {
+        vaapi_av1_decode_uninit(avctx);
         return AVERROR(ENOMEM);
+    }
 
     for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++) {
         ctx->ref_tab[i].frame = av_frame_alloc();
-        if (!ctx->ref_tab[i].frame)
+        if (!ctx->ref_tab[i].frame) {
+            vaapi_av1_decode_uninit(avctx);
             return AVERROR(ENOMEM);
+        }
         ctx->ref_tab[i].valid = 0;
     }
 
-    return ff_vaapi_decode_init(avctx);
+    return ret;
 }
 
 static av_cold int vaapi_av1_decode_uninit(AVCodecContext *avctx)

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to