diff --git a/tsf.h b/tsf.h index a81f25d..94d7812 100644 --- a/tsf.h +++ b/tsf.h @@ -1604,7 +1604,7 @@ TSFDEF int tsf_note_on(tsf* f, int preset_index, int key, float vel) struct tsf_voice* newVoices; f->voiceNum += 4; newVoices = (struct tsf_voice*)TSF_REALLOC(f->voices, f->voiceNum * sizeof(struct tsf_voice)); - if (!newVoices) return 0; + if (!newVoices) { f->voiceNum -= 4; return 0; } f->voices = newVoices; voice = &f->voices[f->voiceNum - 4]; voice[1].playingPreset = voice[2].playingPreset = voice[3].playingPreset = -1; @@ -2077,3 +2077,4 @@ TSFDEF float tsf_channel_get_tuning(tsf* f, int channel) #endif #endif //TSF_IMPLEMENTATION +