Fixed more leaks

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6963 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-12-12 01:25:47 +00:00
parent f8282098aa
commit 65d2fff63c
3 changed files with 18 additions and 1 deletions

View File

@ -118,6 +118,15 @@ MusicInformation::MusicInformation(const std::string& filename) throw (std::runt
} // MusicInformation } // MusicInformation
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
MusicInformation::~MusicInformation()
{
delete m_normal_music;
delete m_fast_music;
}
//-----------------------------------------------------------------------------
void MusicInformation::addMusicToTracks() void MusicInformation::addMusicToTracks()
{ {
for(int i=0; i<(int)m_all_tracks.size(); i++) for(int i=0; i<(int)m_all_tracks.size(); i++)
@ -146,6 +155,8 @@ void MusicInformation::startMusic()
m_normal_filename.c_str()); m_normal_filename.c_str());
return; return;
} }
if (m_normal_music != NULL) delete m_normal_music;
m_normal_music = new MusicOggStream(); m_normal_music = new MusicOggStream();
if((m_normal_music->load(m_normal_filename)) == false) if((m_normal_music->load(m_normal_filename)) == false)
@ -161,7 +172,8 @@ void MusicInformation::startMusic()
// Then (if available) load the music for the last track // Then (if available) load the music for the last track
// ----------------------------------------------------- // -----------------------------------------------------
if(m_fast_filename=="") if (m_fast_music != NULL) delete m_fast_music;
if (m_fast_filename == "")
{ {
m_fast_music = NULL; m_fast_music = NULL;
return; // no fast music return; // no fast music

View File

@ -69,6 +69,7 @@ public:
#pragma warning(disable:4290) #pragma warning(disable:4290)
#endif #endif
MusicInformation (const std::string& filename) throw (std::runtime_error); MusicInformation (const std::string& filename) throw (std::runtime_error);
~MusicInformation ();
const std::string& getComposer () const {return m_composer; } const std::string& getComposer () const {return m_composer; }
const std::string& getTitle () const {return m_title; } const std::string& getTitle () const {return m_title; }
const std::string& getNormalFilename() const {return m_normal_filename; } const std::string& getNormalFilename() const {return m_normal_filename; }

View File

@ -215,6 +215,8 @@ void UnlockManager::load()
std::cerr << "Challenge file '" << filename << "' will be created." std::cerr << "Challenge file '" << filename << "' will be created."
<< std::endl; << std::endl;
save(); save();
if (root) delete root;
return; return;
} }
@ -224,6 +226,8 @@ void UnlockManager::load()
i->second->load(root); i->second->load(root);
} }
computeActive(); computeActive();
delete root;
} // load } // load
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------