mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-23 12:21:39 +00:00
Use FLUID_ARRAY instead of FLUID_MALLOC for sample buffers
This commit is contained in:
parent
312459eaf1
commit
cf04a4ff73
1 changed files with 3 additions and 3 deletions
|
@ -387,14 +387,14 @@ int fluid_sffile_read_sample_data(SFData *sf, unsigned int start, unsigned int c
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
loaded_data = FLUID_MALLOC(count * 2);
|
loaded_data = FLUID_ARRAY(short, count);
|
||||||
if (loaded_data == NULL)
|
if (loaded_data == NULL)
|
||||||
{
|
{
|
||||||
FLUID_LOG(FLUID_ERR, "Out of memory");
|
FLUID_LOG(FLUID_ERR, "Out of memory");
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sf->fcbs->fread(loaded_data, count * 2, sf->sffd) == FLUID_FAILED)
|
if (sf->fcbs->fread(loaded_data, count * sizeof(short), sf->sffd) == FLUID_FAILED)
|
||||||
{
|
{
|
||||||
FLUID_LOG(FLUID_ERR, "Failed to read sample data");
|
FLUID_LOG(FLUID_ERR, "Failed to read sample data");
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
@ -429,7 +429,7 @@ int fluid_sffile_read_sample_data(SFData *sf, unsigned int start, unsigned int c
|
||||||
goto error24_exit;
|
goto error24_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
loaded_data24 = FLUID_MALLOC(count);
|
loaded_data24 = FLUID_ARRAY(char, count);
|
||||||
if (loaded_data24 == NULL)
|
if (loaded_data24 == NULL)
|
||||||
{
|
{
|
||||||
FLUID_LOG(FLUID_ERR, "Out of memory reading 24-bit sample data");
|
FLUID_LOG(FLUID_ERR, "Out of memory reading 24-bit sample data");
|
||||||
|
|
Loading…
Reference in a new issue