Fixed: Possible use after free and null pointer issues
--HG-- branch : develop
This commit is contained in:
parent
1635330a14
commit
70e40339a1
5 changed files with 20 additions and 10 deletions
|
@ -92,7 +92,10 @@ CAudioDecoderMP3::CAudioDecoderMP3(NLMISC::IStream *stream, bool loop)
|
||||||
|
|
||||||
CAudioDecoderMP3::~CAudioDecoderMP3()
|
CAudioDecoderMP3::~CAudioDecoderMP3()
|
||||||
{
|
{
|
||||||
|
if (_IsSupported)
|
||||||
|
{
|
||||||
drmp3_uninit(&_Decoder);
|
drmp3_uninit(&_Decoder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioDecoderMP3::isFormatSupported() const
|
bool CAudioDecoderMP3::isFormatSupported() const
|
||||||
|
|
|
@ -704,7 +704,9 @@ void CComplexSource::checkup()
|
||||||
for (; first != last; ++first)
|
for (; first != last; ++first)
|
||||||
{
|
{
|
||||||
USource *source = *first;
|
USource *source = *first;
|
||||||
if (source != NULL && source->getSound()->getLooping() && !source->isPlaying())
|
if (source == NULL)
|
||||||
|
continue;
|
||||||
|
if (source->getSound()->getLooping() && !source->isPlaying())
|
||||||
source->play();
|
source->play();
|
||||||
if (source->getSound()->getSoundType() != CSound::SOUND_SIMPLE)
|
if (source->getSound()->getSoundType() != CSound::SOUND_SIMPLE)
|
||||||
static_cast<CSourceCommon*>(source)->checkup();
|
static_cast<CSourceCommon*>(source)->checkup();
|
||||||
|
|
|
@ -194,6 +194,10 @@ uint CSourceAL::countStreamingBuffers() const
|
||||||
// a bit ugly here, but makes a much easier/simpler implementation on both drivers
|
// a bit ugly here, but makes a much easier/simpler implementation on both drivers
|
||||||
ALint buffersProcessed;
|
ALint buffersProcessed;
|
||||||
alGetSourcei(_Source, AL_BUFFERS_PROCESSED, &buffersProcessed);
|
alGetSourcei(_Source, AL_BUFFERS_PROCESSED, &buffersProcessed);
|
||||||
|
if (buffersProcessed && _QueuedBuffers.empty())
|
||||||
|
{
|
||||||
|
nlwarning("AL: QueuedBuffers is empty, but OpenAL buffers processed > 0");
|
||||||
|
}
|
||||||
while (buffersProcessed && !_QueuedBuffers.empty())
|
while (buffersProcessed && !_QueuedBuffers.empty())
|
||||||
{
|
{
|
||||||
ALuint bufferName = _QueuedBuffers.front()->bufferName();
|
ALuint bufferName = _QueuedBuffers.front()->bufferName();
|
||||||
|
|
|
@ -82,15 +82,16 @@ void CSampleBankManager::init(NLGEORGES::UFormElm *mixerConfig)
|
||||||
TFilteredBank fb;
|
TFilteredBank fb;
|
||||||
std::string bankName;
|
std::string bankName;
|
||||||
NLGEORGES::UFormElm *realBank = NULL;
|
NLGEORGES::UFormElm *realBank = NULL;
|
||||||
realBank->getArrayNode(&realBank, j);
|
realBanks->getArrayNode(&realBank, j);
|
||||||
|
if (realBank != 0)
|
||||||
|
{
|
||||||
realBank->getValueByName(bankName, ".SampleBank");
|
realBank->getValueByName(bankName, ".SampleBank");
|
||||||
fb.BankName = CStringMapper::map(bankName);
|
fb.BankName = CStringMapper::map(bankName);
|
||||||
realBank->getValueByName(fb.Filter, ".Filter");
|
realBank->getValueByName(fb.Filter, ".Filter");
|
||||||
|
|
||||||
vfb.push_back(fb);
|
vfb.push_back(fb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!vfb.empty())
|
if (!vfb.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,7 @@ void CStreamSource::releasePhysicalSource()
|
||||||
// free the track
|
// free the track
|
||||||
pSource->stop();
|
pSource->stop();
|
||||||
pSource->setStreaming(false);
|
pSource->setStreaming(false);
|
||||||
mixer->freeTrack(m_Track);
|
if (mixer) mixer->freeTrack(m_Track);
|
||||||
m_Track = NULL;
|
m_Track = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue