Skip to content

Commit

Permalink
plugins: delay ugens - rt memory allocation may fail
Browse files Browse the repository at this point in the history
fixes a possible crash in sampling ugens

Signed-off-by: Tim Blechmann <tim@klingt.org>
  • Loading branch information
timblechmann committed Jul 1, 2011
1 parent 3e00bfd commit db45465
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion common/Source/plugins/DelayUGens.cpp
Expand Up @@ -794,6 +794,11 @@ inline double sc_loop(Unit *unit, double in, double hi, int loop)
} \
if(!unit->mOut){ \
unit->mOut = (float**)RTAlloc(unit->mWorld, numOutputs * sizeof(float*)); \
if (unit->mOut == NULL) { \
unit->mDone = true; \
ClearUnitOutputs(unit, inNumSamples); \
return; \
} \
} \
float **out = unit->mOut; \
for (uint32 i=0; i<numOutputs; ++i){ \
Expand All @@ -811,12 +816,17 @@ inline double sc_loop(Unit *unit, double in, double hi, int loop)
if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
Print("buffer-writing UGen channel mismatch: numInputs %i, yet buffer has %i channels\n", numInputs, bufChannels); \
} \
unit->mDone = true; \
unit->mDone = true; \
ClearUnitOutputs(unit, inNumSamples); \
return; \
} \
if(!unit->mIn){ \
unit->mIn = (float**)RTAlloc(unit->mWorld, numInputs * sizeof(float*)); \
if (unit->mIn == NULL) { \
unit->mDone = true; \
ClearUnitOutputs(unit, inNumSamples); \
return; \
} \
} \
float **in = unit->mIn; \
for (uint32 i=0; i<numInputs; ++i) { \
Expand Down

0 comments on commit db45465

Please sign in to comment.