Skip to content

Commit

Permalink
Fix a crash when unloading sound data
Browse files Browse the repository at this point in the history
This would occur when the sound data was loaded with the
ClownAudio_Mixer_LoadSoundDataFromMemory function. Some unused
pointers weren't being initialised.
  • Loading branch information
Clownacy committed Mar 22, 2021
1 parent c6703fb commit 7e36607
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ CLOWNAUDIO_EXPORT ClownAudio_SoundData* ClownAudio_Mixer_LoadSoundDataFromMemory
wanted_spec.sample_rate = config->dynamic_sample_rate ? 0 : mixer->sample_rate; // Do not change the sample rate when dynamic resampling is enabled
wanted_spec.channel_count = CHANNEL_COUNT;

sound_data->file_buffers[0] = NULL;
sound_data->file_buffers[1] = NULL;

if (file_buffer1 != NULL && file_buffer2 != NULL)
{
sound_data->decoder_selector_data[0] = DecoderSelector_LoadData(file_buffer1, file_size1, config->predecode, config->must_predecode, &wanted_spec);
Expand Down

0 comments on commit 7e36607

Please sign in to comment.