diff mbox series

[FFmpeg-devel,191/217] avcodec/binkaudio: Check return value of functions that can fail

Message ID 20201202042244.519127-57-andreas.rheinhardt@gmail.com
State Accepted
Commit 0062aca592868e9fd7b6fcb322747d42d71e7315
Headers show
Series [FFmpeg-devel,01/45] avcodec/a64multienc: Fix memleak upon init failure
Related show

Checks

Context Check Description
andriy/x86 warning Failed to apply patch

Commit Message

Andreas Rheinhardt Dec. 2, 2020, 4:22 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/binkaudio.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Andreas Rheinhardt April 2, 2021, 4:24 p.m. UTC | #1
On Wed, Dec 2, 2020 at 5:24 AM Andreas Rheinhardt <
andreas.rheinhardt@gmail.com> wrote:

> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/binkaudio.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
> index f25aea0d64..2ee6f95f78 100644
> --- a/libavcodec/binkaudio.c
> +++ b/libavcodec/binkaudio.c
> @@ -69,7 +69,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
>      BinkAudioContext *s = avctx->priv_data;
>      int sample_rate = avctx->sample_rate;
>      int sample_rate_half;
> -    int i;
> +    int i, ret;
>      int frame_len_bits;
>
>      /* determine frame length */
> @@ -131,11 +131,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
>      s->first = 1;
>
>      if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id ==
> AV_CODEC_ID_BINKAUDIO_RDFT)
> -        ff_rdft_init(&s->trans.rdft, frame_len_bits, DFT_C2R);
> +        ret = ff_rdft_init(&s->trans.rdft, frame_len_bits, DFT_C2R);
>      else if (CONFIG_BINKAUDIO_DCT_DECODER)
> -        ff_dct_init(&s->trans.dct, frame_len_bits, DCT_III);
> +        ret = ff_dct_init(&s->trans.dct, frame_len_bits, DCT_III);
>      else
>          av_assert0(0);
> +    if (ret < 0)
> +        return ret;
>
>      s->pkt = av_packet_alloc();
>      if (!s->pkt)
> --
> 2.25.1
>
>

Will apply.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index f25aea0d64..2ee6f95f78 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -69,7 +69,7 @@  static av_cold int decode_init(AVCodecContext *avctx)
     BinkAudioContext *s = avctx->priv_data;
     int sample_rate = avctx->sample_rate;
     int sample_rate_half;
-    int i;
+    int i, ret;
     int frame_len_bits;
 
     /* determine frame length */
@@ -131,11 +131,13 @@  static av_cold int decode_init(AVCodecContext *avctx)
     s->first = 1;
 
     if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT)
-        ff_rdft_init(&s->trans.rdft, frame_len_bits, DFT_C2R);
+        ret = ff_rdft_init(&s->trans.rdft, frame_len_bits, DFT_C2R);
     else if (CONFIG_BINKAUDIO_DCT_DECODER)
-        ff_dct_init(&s->trans.dct, frame_len_bits, DCT_III);
+        ret = ff_dct_init(&s->trans.dct, frame_len_bits, DCT_III);
     else
         av_assert0(0);
+    if (ret < 0)
+        return ret;
 
     s->pkt = av_packet_alloc();
     if (!s->pkt)