mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-28 06:52:57 +00:00
Fix two memory leaks in the sequencer.
This commit is contained in:
parent
7993412330
commit
4880b8e574
1 changed files with 30 additions and 0 deletions
|
@ -292,6 +292,7 @@ void fluid_sequencer_unregister_client(fluid_sequencer_t* seq, short id)
|
|||
FLUID_FREE(client->name);
|
||||
seq->clients = fluid_list_remove_link(seq->clients, tmp);
|
||||
delete1_fluid_list(tmp);
|
||||
FLUID_FREE(client);
|
||||
delete_fluid_event(evt);
|
||||
return;
|
||||
}
|
||||
|
@ -556,6 +557,7 @@ double fluid_sequencer_get_time_scale(fluid_sequencer_t* seq)
|
|||
void _fluid_seq_queue_insert_entry(fluid_sequencer_t* seq, fluid_evt_entry * evtentry);
|
||||
void _fluid_seq_queue_remove_entries_matching(fluid_sequencer_t* seq, fluid_evt_entry* temp);
|
||||
void _fluid_seq_queue_send_queued_events(fluid_sequencer_t* seq);
|
||||
void _fluid_free_evt_queue(fluid_evt_entry** first, fluid_evt_entry** last);
|
||||
|
||||
|
||||
/********************/
|
||||
|
@ -596,6 +598,17 @@ _fluid_seq_queue_init(fluid_sequencer_t* seq, int maxEvents)
|
|||
void
|
||||
_fluid_seq_queue_end(fluid_sequencer_t* seq)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* free all remaining events */
|
||||
_fluid_free_evt_queue(&seq->preQueue, &seq->preQueueLast);
|
||||
for (i = 0; i < 256; i++)
|
||||
_fluid_free_evt_queue(&(seq->queue0[i][0]), &(seq->queue0[i][1]));
|
||||
for (i = 0; i < 255; i++)
|
||||
_fluid_free_evt_queue(&(seq->queue1[i][0]), &(seq->queue1[i][1]));
|
||||
_fluid_free_evt_queue(&seq->queueLater, NULL);
|
||||
|
||||
|
||||
if (seq->timer) {
|
||||
delete_fluid_timer(seq->timer);
|
||||
seq->timer = NULL;
|
||||
|
@ -605,6 +618,7 @@ _fluid_seq_queue_end(fluid_sequencer_t* seq)
|
|||
_fluid_evt_heap_free(seq->heap);
|
||||
seq->heap = NULL;
|
||||
}
|
||||
|
||||
fluid_mutex_destroy(seq->mutex);
|
||||
}
|
||||
|
||||
|
@ -683,6 +697,22 @@ _fluid_seq_queue_pre_remove(fluid_sequencer_t* seq, short src, short dest, int t
|
|||
return;
|
||||
}
|
||||
|
||||
void
|
||||
_fluid_free_evt_queue(fluid_evt_entry** first, fluid_evt_entry** last)
|
||||
{
|
||||
fluid_evt_entry* tmp2;
|
||||
fluid_evt_entry* tmp = *first;
|
||||
while (tmp != NULL) {
|
||||
tmp2 = tmp->next;
|
||||
FLUID_FREE(tmp);
|
||||
tmp = tmp2;
|
||||
}
|
||||
*first = NULL;
|
||||
if (last != NULL) {
|
||||
*last = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************
|
||||
* callback from timer
|
||||
* (may be in a different thread, or in an interrupt)
|
||||
|
|
Loading…
Reference in a new issue