diff mbox series

[FFmpeg-devel] avcodec/nellymoserenc: Fix segfault when using unsupported channels/rate

Message ID HE1PR0301MB215430B174C2919672DB3C678F4D9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 652279e35becae7b4c0b6b73e4f6c074e8a8b77c
Headers show
Series [FFmpeg-devel] avcodec/nellymoserenc: Fix segfault when using unsupported channels/rate
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 April 15, 2021, 1:52 p.m. UTC
NellyMoserEncodeContext.avctx is only set in init after these checks,
yet it is used by encode_end().
This is a regression since 0a56bfa71f751a2b25da8d060a019c1c75ca9d7b.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Sorry for this. Will apply soon and backport.

 libavcodec/nellymoserenc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer April 15, 2021, 3:36 p.m. UTC | #1
On Thu, Apr 15, 2021 at 03:52:31PM +0200, Andreas Rheinhardt wrote:
> NellyMoserEncodeContext.avctx is only set in init after these checks,
> yet it is used by encode_end().
> This is a regression since 0a56bfa71f751a2b25da8d060a019c1c75ca9d7b.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> Sorry for this. Will apply soon and backport.
> 
>  libavcodec/nellymoserenc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c
> index 99ede2f42b..8670431dcc 100644
> --- a/libavcodec/nellymoserenc.c
> +++ b/libavcodec/nellymoserenc.c
> @@ -138,10 +138,8 @@ static av_cold int encode_end(AVCodecContext *avctx)
>  
>      ff_mdct_end(&s->mdct_ctx);
>  
> -    if (s->avctx->trellis) {
> -        av_freep(&s->opt);
> -        av_freep(&s->path);
> -    }
> +    av_freep(&s->opt);
> +    av_freep(&s->path);

didnt test but LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c
index 99ede2f42b..8670431dcc 100644
--- a/libavcodec/nellymoserenc.c
+++ b/libavcodec/nellymoserenc.c
@@ -138,10 +138,8 @@  static av_cold int encode_end(AVCodecContext *avctx)
 
     ff_mdct_end(&s->mdct_ctx);
 
-    if (s->avctx->trellis) {
-        av_freep(&s->opt);
-        av_freep(&s->path);
-    }
+    av_freep(&s->opt);
+    av_freep(&s->path);
     ff_af_queue_close(&s->afq);
     av_freep(&s->fdsp);