diff mbox series

[FFmpeg-devel,09/10] fftools/ffplay: Check return of swr_alloc_set_opts2()

Message ID 20240427235424.3075968-9-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/10] fftools/ffmpeg_enc: simplify opaque_ref check | expand

Checks

Context Check Description
yinshiyou/make_fate_loongarch64 success Make fate finished
yinshiyou/make_loongarch64 warning New warnings during build

Commit Message

Michael Niedermayer April 27, 2024, 11:54 p.m. UTC
This probably makes no difference but its more correct

Fixes: CID1503080 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 fftools/ffplay.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer May 9, 2024, 1:31 a.m. UTC | #1
On Sun, Apr 28, 2024 at 01:54:23AM +0200, Michael Niedermayer wrote:
> This probably makes no difference but its more correct
> 
> Fixes: CID1503080 Unchecked return value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  fftools/ffplay.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

[...]
diff mbox series

Patch

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index d4300d5d46e..63a9806fb80 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2392,11 +2392,11 @@  static int audio_decode_frame(VideoState *is)
         af->frame->sample_rate   != is->audio_src.freq           ||
         (wanted_nb_samples       != af->frame->nb_samples && !is->swr_ctx)) {
         swr_free(&is->swr_ctx);
-        swr_alloc_set_opts2(&is->swr_ctx,
+        int ret = swr_alloc_set_opts2(&is->swr_ctx,
                             &is->audio_tgt.ch_layout, is->audio_tgt.fmt, is->audio_tgt.freq,
                             &af->frame->ch_layout, af->frame->format, af->frame->sample_rate,
                             0, NULL);
-        if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) {
+        if (ret < 0 || swr_init(is->swr_ctx) < 0) {
             av_log(NULL, AV_LOG_ERROR,
                    "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
                     af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), af->frame->ch_layout.nb_channels,