diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-10-06 16:33:00 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-10-10 14:19:57 +0200 |
commit | 304cc0379870ebf155502069939582f1065ef3b5 (patch) | |
tree | cc53bc03636355c4d36e2d3b8f3771a0cdb6a664 /libavfilter/asrc_flite.c | |
parent | 9a1547ba1e4e733aaf8d77ccc3d3576edea9f190 (diff) |
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@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/asrc_flite.c')
-rw-r--r-- | libavfilter/asrc_flite.c | 10 |
1 files 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; } |