]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/nellymoserenc: Fix segfault when using unsupported channels/rate
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 15 Apr 2021 13:48:34 +0000 (15:48 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 15 Apr 2021 16:15:57 +0000 (18:15 +0200)
NellyMoserEncodeContext.avctx is only set in init after these checks,
yet it is used by encode_end().
This is a regression since 0a56bfa71f751a2b25da8d060a019c1c75ca9d7b.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/nellymoserenc.c

index 99ede2f42b4a95e4c66c5ddebe755b09846c8d57..8670431dcc45ebb2039cbcf46c085cee40e1c195 100644 (file)
@@ -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);