diff mbox series

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

Message ID 20241012172540.2367272-1-marth64@proxyid.net
State New
Headers show
Series [FFmpeg-devel] avformat/hlsenc: check return value of avcodec_parameters_copy() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Marth64 Oct. 12, 2024, 5:25 p.m. UTC
Written in the dominant style of the surrounding code block.

Signed-off-by: Marth64 <marth64@proxyid.net>
---
 libavformat/hlsenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Steven Liu Oct. 13, 2024, 12:42 a.m. UTC | #1
Marth64 <marth64@proxyid.net> 于2024年10月13日周日 01:25写道:
>
> Written in the dominant style of the surrounding code block.
>
> Signed-off-by: Marth64 <marth64@proxyid.net>
> ---
>  libavformat/hlsenc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 571d6b2752..1b3f3ef2bb 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) {
> --
> 2.34.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".


LGTM


Thanks
Steven
Steven Liu Oct. 13, 2024, 3:10 p.m. UTC | #2
Steven Liu <lingjiujianke@gmail.com> 于2024年10月13日周日 08:42写道:
>
> Marth64 <marth64@proxyid.net> 于2024年10月13日周日 01:25写道:
> >
> > Written in the dominant style of the surrounding code block.
> >
> > Signed-off-by: Marth64 <marth64@proxyid.net>
> > ---
> >  libavformat/hlsenc.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> > index 571d6b2752..1b3f3ef2bb 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) {
> > --
> > 2.34.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
>
> LGTM
pushed


Thanks
Steven
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 571d6b2752..1b3f3ef2bb 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) {