From f46415f37332c4291882ae1b403aaf8179e3ea49 Mon Sep 17 00:00:00 2001 From: Marth64 Date: Sat, 12 Oct 2024 12:25:40 -0500 Subject: [PATCH] avformat/hlsenc: check return value of avcodec_parameters_copy() Written in the dominant style of the surrounding code block. Signed-off-by: Marth64 Reviewed-by: Steven Liu --- libavformat/hlsenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 8d81452264..6148685f40 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -888,7 +888,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) {