PR #23514 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23514
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23514.patch

The branch returned the ret variable when av_malloc() failed, but ret
is uninitialized at that point unless an earlier branch happened to
set it.


>From bf10398efbc9910ae7491ec2f15ab72731972ad8 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Wed, 17 Jun 2026 15:11:25 +0800
Subject: [PATCH] avformat/matroskaenc: fix error code on LCEVC payload
 allocation failure

The branch returned the ret variable when av_malloc() failed, but ret
is uninitialized at that point unless an earlier branch happened to
set it.
---
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 7aa78754f3..97d66558f8 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2995,7 +2995,7 @@ static int mkv_write_block(void *logctx, 
MatroskaMuxContext *mkv,
 
             lcevc = av_malloc(payload_size);
             if (!lcevc)
-                return ret;
+                return AVERROR(ENOMEM);
 
             AV_WB8 (lcevc + 0, ITU_T_T35_COUNTRY_CODE_UK);
             AV_WB8 (lcevc + 1, 0); // t35_uk_country_code_second_octet
-- 
2.52.0

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

Reply via email to