mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-11 05:11:33 +00:00
midifile loader: Fix memory leaks in error paths (#120)
Patch credit: surabhi-mishra
This commit is contained in:
parent
aa4d7b06df
commit
d7d7fb1103
1 changed files with 3 additions and 0 deletions
|
@ -366,6 +366,7 @@ fluid_midi_file_read_track(fluid_midi_file *mf, fluid_player_t *player, int num)
|
|||
|
||||
while (!fluid_midi_file_eot(mf)) {
|
||||
if (fluid_midi_file_read_event(mf, track) != FLUID_OK) {
|
||||
delete_fluid_track(track);
|
||||
return FLUID_FAILED;
|
||||
}
|
||||
}
|
||||
|
@ -1490,6 +1491,7 @@ fluid_player_load(fluid_player_t *player, fluid_playlist_item *item)
|
|||
buffer = fluid_file_read_full(fp, &buffer_length);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
FLUID_FCLOSE(fp);
|
||||
return FLUID_FAILED;
|
||||
}
|
||||
buffer_owned = 1;
|
||||
|
@ -1521,6 +1523,7 @@ fluid_player_load(fluid_player_t *player, fluid_playlist_item *item)
|
|||
if (buffer_owned) {
|
||||
FLUID_FREE(buffer);
|
||||
}
|
||||
delete_fluid_midi_file(midifile);
|
||||
return FLUID_FAILED;
|
||||
}
|
||||
delete_fluid_midi_file(midifile);
|
||||
|
|
Loading…
Reference in a new issue