diff options
author | Chris Robinson <[email protected]> | 2013-12-08 06:20:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-12-08 06:20:44 -0800 |
commit | 5349b90a483b25bc5f41ba6545bbebf0843bdbdc (patch) | |
tree | 1c5f1bfd0d327654b395ccc5236ab13e18e0b3ab /OpenAL32/alMidi.c | |
parent | ac525db845ff0ecc2018f333d6d189db24ffcbfd (diff) |
Fix leak if inserting a sysex event fails
Diffstat (limited to 'OpenAL32/alMidi.c')
-rw-r--r-- | OpenAL32/alMidi.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c index 01fd13a9..8f9acd7d 100644 --- a/OpenAL32/alMidi.c +++ b/OpenAL32/alMidi.c @@ -158,7 +158,11 @@ static ALenum MidiSynth_insertSysExEvent(MidiSynth *self, ALuint64 time, const A memcpy(entry.param.sysex.data, data, size); err = InsertEvtQueue(&self->EventQueue, &entry); - if(err != AL_NO_ERROR) return err; + if(err != AL_NO_ERROR) + { + free(entry.param.sysex.data); + return err; + } if(entry.time < self->NextEvtTime) { @@ -256,8 +260,7 @@ static ALboolean FSynth_init(FSynth *self, ALCdevice *device) static ALboolean FSynth_isSoundfont(FSynth *self, const char *filename) { filename = MidiSynth_getFontName(STATIC_CAST(MidiSynth, self), filename); - if(!filename[0]) - return AL_FALSE; + if(!filename[0]) return AL_FALSE; if(!fluid_is_soundfont(filename)) return AL_FALSE; @@ -269,8 +272,7 @@ static ALenum FSynth_loadSoundfont(FSynth *self, const char *filename) int fontid; filename = MidiSynth_getFontName(STATIC_CAST(MidiSynth, self), filename); - if(!filename[0]) - return AL_INVALID_VALUE; + if(!filename[0]) return AL_INVALID_VALUE; fontid = fluid_synth_sfload(self->Synth, filename, 1); if(fontid == FLUID_FAILED) |