aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/reverb.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-05-21 03:27:51 -0700
committerChris Robinson <[email protected]>2016-05-21 03:27:51 -0700
commit2e7ec3979aec71f11c45b737b77d58978cbee7e2 (patch)
treec931d2f9b55cc6803a00896f92793a58de8fdc11 /Alc/effects/reverb.c
parent7bf64eaee0788b7eb64c7410384a9ee66f75c4ce (diff)
Avoid using realloc in a number of places
Diffstat (limited to 'Alc/effects/reverb.c')
-rw-r--r--Alc/effects/reverb.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index 3f22b787..f8680d24 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -170,7 +170,7 @@ typedef struct ALreverbState {
static ALvoid ALreverbState_Destruct(ALreverbState *State)
{
- free(State->SampleBuffer);
+ al_free(State->SampleBuffer);
State->SampleBuffer = NULL;
ALeffectState_Destruct(STATIC_CAST(ALeffectState,State));
}
@@ -295,7 +295,6 @@ static ALboolean AllocLines(ALuint frequency, ALreverbState *State)
{
ALuint totalSamples, index;
ALfloat length;
- ALfloat *newBuffer = NULL;
// All delay line lengths are calculated to accomodate the full range of
// lengths given their respective paramters.
@@ -352,10 +351,13 @@ static ALboolean AllocLines(ALuint frequency, ALreverbState *State)
if(totalSamples != State->TotalSamples)
{
+ ALfloat *newBuffer;
+
TRACE("New reverb buffer length: %u samples (%f sec)\n", totalSamples, totalSamples/(float)frequency);
- newBuffer = realloc(State->SampleBuffer, sizeof(ALfloat) * totalSamples);
- if(newBuffer == NULL)
- return AL_FALSE;
+ newBuffer = al_calloc(16, sizeof(ALfloat) * totalSamples);
+ if(!newBuffer) return AL_FALSE;
+
+ al_free(State->SampleBuffer);
State->SampleBuffer = newBuffer;
State->TotalSamples = totalSamples;
}