Fixed a memory leak in Sources created from SoundData.

This commit is contained in:
Alex Szpakowski
2014-09-04 13:33:18 -03:00
parent 77bec45b4a
commit 346aa7d839
+4 -1
View File
@@ -68,7 +68,10 @@ Source::Source(Pool *pool, love::sound::SoundData *soundData)
, toLoop(0)
{
ALenum fmt = getFormat(soundData->getChannels(), soundData->getBitDepth());
staticBuffer = new StaticDataBuffer(fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate());
staticBuffer.set(new StaticDataBuffer(fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate()));
// The buffer has a +2 retain count right now, but we want it to have +1.
staticBuffer->release();
float z[3] = {0, 0, 0};