mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-01-31 21:50:37 +00:00
Fix a NULL deref in delete_rvoice_mixer_threads() (#641)
The function attempts to lock a mutex that might have not been created yet, due to a previous error.
This commit is contained in:
parent
ff14432cd9
commit
e2d435dad6
1 changed files with 24 additions and 18 deletions
|
@ -1266,6 +1266,11 @@ fluid_render_loop_multithread(fluid_rvoice_mixer_t *mixer, int current_blockcoun
|
||||||
static void delete_rvoice_mixer_threads(fluid_rvoice_mixer_t *mixer)
|
static void delete_rvoice_mixer_threads(fluid_rvoice_mixer_t *mixer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// if no threads have been created yet (e.g. because a previous error prevented creation of threads
|
||||||
|
// mutexes and condition variables), skip terminating threads
|
||||||
|
if(mixer->thread_count != 0)
|
||||||
|
{
|
||||||
fluid_atomic_int_set(&mixer->threads_should_terminate, 1);
|
fluid_atomic_int_set(&mixer->threads_should_terminate, 1);
|
||||||
// Signal threads to wake up
|
// Signal threads to wake up
|
||||||
fluid_cond_mutex_lock(mixer->wakeup_threads_m);
|
fluid_cond_mutex_lock(mixer->wakeup_threads_m);
|
||||||
|
@ -1288,6 +1293,7 @@ static void delete_rvoice_mixer_threads(fluid_rvoice_mixer_t *mixer)
|
||||||
|
|
||||||
fluid_mixer_buffers_free(&mixer->threads[i]);
|
fluid_mixer_buffers_free(&mixer->threads[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FLUID_FREE(mixer->threads);
|
FLUID_FREE(mixer->threads);
|
||||||
mixer->thread_count = 0;
|
mixer->thread_count = 0;
|
||||||
|
|
Loading…
Reference in a new issue