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()
|
||||
{
|
||||
drmp3_uninit(&_Decoder);
|
||||
if (_IsSupported)
|
||||
{
|
||||
drmp3_uninit(&_Decoder);
|
||||
}
|
||||
}
|
||||
|
||||
bool CAudioDecoderMP3::isFormatSupported() const
|
||||
|
|
|
@ -704,7 +704,9 @@ void CComplexSource::checkup()
|
|||
for (; first != last; ++first)
|
||||
{
|
||||
USource *source = *first;
|
||||
if (source != NULL && source->getSound()->getLooping() && !source->isPlaying())
|
||||
if (source == NULL)
|
||||
continue;
|
||||
if (source->getSound()->getLooping() && !source->isPlaying())
|
||||
source->play();
|
||||
if (source->getSound()->getSoundType() != CSound::SOUND_SIMPLE)
|
||||
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
|
||||
ALint 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())
|
||||
{
|
||||
ALuint bufferName = _QueuedBuffers.front()->bufferName();
|
||||
|
|
|
@ -82,13 +82,14 @@ void CSampleBankManager::init(NLGEORGES::UFormElm *mixerConfig)
|
|||
TFilteredBank fb;
|
||||
std::string bankName;
|
||||
NLGEORGES::UFormElm *realBank = NULL;
|
||||
realBank->getArrayNode(&realBank, j);
|
||||
|
||||
realBank->getValueByName(bankName, ".SampleBank");
|
||||
fb.BankName = CStringMapper::map(bankName);
|
||||
realBank->getValueByName(fb.Filter, ".Filter");
|
||||
|
||||
vfb.push_back(fb);
|
||||
realBanks->getArrayNode(&realBank, j);
|
||||
if (realBank != 0)
|
||||
{
|
||||
realBank->getValueByName(bankName, ".SampleBank");
|
||||
fb.BankName = CStringMapper::map(bankName);
|
||||
realBank->getValueByName(fb.Filter, ".Filter");
|
||||
vfb.push_back(fb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ void CStreamSource::releasePhysicalSource()
|
|||
// free the track
|
||||
pSource->stop();
|
||||
pSource->setStreaming(false);
|
||||
mixer->freeTrack(m_Track);
|
||||
if (mixer) mixer->freeTrack(m_Track);
|
||||
m_Track = NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue