fix a NULL deref in coreaudio driver

This commit is contained in:
derselbst 2018-10-30 17:58:45 +01:00
parent ffdf5b89d7
commit 31ccc6b6a0
1 changed files with 7 additions and 4 deletions

View File

@ -266,10 +266,7 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
}
}
if(devname)
{
FLUID_FREE(devname); /* free device name */
}
dev->buffer_size = period_size * periods;
@ -323,6 +320,12 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
dev->buffers[0] = FLUID_ARRAY(float, dev->buffer_size);
dev->buffers[1] = FLUID_ARRAY(float, dev->buffer_size);
if(dev->buffers[0] == NULL || dev->buffers[1] == NULL)
{
FLUID_LOG(FLUID_ERR, "Out of memory.");
goto error_recovery;
}
// Initialize the audio unit
status = AudioUnitInitialize(dev->outputUnit);