diff mbox series

[FFmpeg-devel,17/30] avcodec/opusdec: Return error upon error

Message ID 20201230233157.1055287-17-andreas.rheinhardt@gmail.com
State Accepted
Commit 794fb18369be7dae9f9844c83040bb06611ff890
Headers show
Series [FFmpeg-devel,01/30] avcodec/opustab: Make array static
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 30, 2020, 11:31 p.m. UTC
The Opus decoder forgot to return an error when allocating an
SwrContext fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/opusdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Dec. 31, 2020, 12:17 a.m. UTC | #1
On Thu, Dec 31, 2020 at 12:31:44AM +0100, Andreas Rheinhardt wrote:
> The Opus decoder forgot to return an error when allocating an
> SwrContext fails.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/opusdec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

LGTM

thx

[...]
diff mbox series

Patch

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);