[FFmpeg-devel] [PATCH 5/8] avfilter/asrc_flite: Don't segfault when using list_voices option

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Oct 7 12:31:25 EEST 2021


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.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 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 c861f5c238..0789dd6ff3 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;
 }
-- 
2.30.2



More information about the ffmpeg-devel mailing list