[FFmpeg-cvslog] avformat/hlsenc: check return value of avcodec_parameters_copy()

Marth64 git at videolan.org
Wed Jan 8 07:52:08 EET 2025


ffmpeg | branch: release/7.1 | Marth64 <marth64 at proxyid.net> | Sat Oct 12 12:25:40 2024 -0500| [dd78b9ed7c5ee97e9eb2bd03f8387c2d6348ceca] | committer: Marth64

avformat/hlsenc: check return value of avcodec_parameters_copy()

Written in the dominant style of the surrounding code block.

Signed-off-by: Marth64 <marth64 at proxyid.net>
Reviewed-by: Steven Liu <lq at chinaffmpeg.org>
(cherry picked from commit f46415f37332c4291882ae1b403aaf8179e3ea49)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd78b9ed7c5ee97e9eb2bd03f8387c2d6348ceca
---

 libavformat/hlsenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 1e932b7b0e..081d91f7d9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -887,7 +887,9 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
 
         if (!(st = avformat_new_stream(loc, NULL)))
             return AVERROR(ENOMEM);
-        avcodec_parameters_copy(st->codecpar, vs->streams[i]->codecpar);
+        ret = avcodec_parameters_copy(st->codecpar, vs->streams[i]->codecpar);
+        if (ret < 0)
+            return ret;
         if (!oc->oformat->codec_tag ||
             av_codec_get_id (oc->oformat->codec_tag, vs->streams[i]->codecpar->codec_tag) == st->codecpar->codec_id ||
             av_codec_get_tag(oc->oformat->codec_tag, vs->streams[i]->codecpar->codec_id) <= 0) {



More information about the ffmpeg-cvslog mailing list