[FFmpeg-cvslog] avcodec/opusdec: Return error upon error

Andreas Rheinhardt git at videolan.org
Fri Jan 1 01:07:33 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Dec 28 17:52:12 2020 +0100| [794fb18369be7dae9f9844c83040bb06611ff890] | committer: Andreas Rheinhardt

avcodec/opusdec: Return error upon error

The Opus decoder forgot to return an error when allocating an
SwrContext fails.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Reviewed-by: Lynne <dev at lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

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

diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
index 86a3181e9d..462d70b3bf 100644
--- a/libavcodec/opusdec.c
+++ b/libavcodec/opusdec.c
@@ -671,8 +671,10 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
         s->fdsp = c->fdsp;
 
         s->swr =swr_alloc();
-        if (!s->swr)
+        if (!s->swr) {
+            ret = AVERROR(ENOMEM);
             goto fail;
+        }
 
         layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
         av_opt_set_int(s->swr, "in_sample_fmt",      avctx->sample_fmt,  0);



More information about the ffmpeg-cvslog mailing list