[FFmpeg-cvslog] avfilter/asrc_flite: Don't segfault when using list_voices option

Andreas Rheinhardt git at videolan.org
Wed Jan 12 02:50:26 EET 2022


ffmpeg | branch: release/4.4 | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Oct  6 16:33:00 2021 +0200| [566d7896c116f1a16935b5b28599598a2e69e113] | committer: Andreas Rheinhardt

avfilter/asrc_flite: Don't segfault when using list_voices option

Could also happen if initializing flite failed* or if an unknown voice
has been selected or if registering the voice failed.

*: which it currently can't, because it is a no-op.

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
(cherry picked from commit 304cc0379870ebf155502069939582f1065ef3b5)

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

 libavfilter/asrc_flite.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavfilter/asrc_flite.c b/libavfilter/asrc_flite.c
index 3e543a3ab6..71924e7e1a 100644
--- a/libavfilter/asrc_flite.c
+++ b/libavfilter/asrc_flite.c
@@ -196,10 +196,12 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
     FliteContext *flite = ctx->priv;
 
-    if (!--flite->voice_entry->usage_count)
-        flite->voice_entry->unregister_fn(flite->voice);
-    flite->voice = NULL;
-    flite->voice_entry = NULL;
+    if (flite->voice_entry) {
+        if (!--flite->voice_entry->usage_count)
+            flite->voice_entry->unregister_fn(flite->voice);
+        flite->voice = NULL;
+        flite->voice_entry = NULL;
+    }
     delete_wave(flite->wave);
     flite->wave = NULL;
 }



More information about the ffmpeg-cvslog mailing list