fix endless loop in fluid_sample_timer_process()

This commit is contained in:
derselbst 2018-05-18 09:58:05 +02:00
parent b40fb9d782
commit df4c9878de

View file

@ -489,13 +489,13 @@ void fluid_sample_timer_process(fluid_synth_t* synth)
unsigned int ticks = fluid_synth_get_ticks(synth);
for (st=synth->sample_timers; st; st=stnext) {
/* st may be freed in the callback below. cache it's successor now to avoid use after free */
stnext = st->next;
if (st->isfinished) {
continue;
}
msec = (long) (1000.0*((double) (ticks - st->starttick))/synth->sample_rate);
/* st may be freed in the callback below. cache it's successor now to avoid use after free */
stnext = st->next;
cont = (*st->callback)(st->data, msec);
if (cont == 0) {
st->isfinished = 1;