Fix memory leaks in mru.cpp

Originally committed to SVN as r4348.
This commit is contained in:
Thomas Goyne 2010-05-23 06:58:06 +00:00
parent 9fc28fc1d4
commit 60a1bdc2df

View file

@ -46,6 +46,7 @@ MRUManager::MRUManager(const std::string &config, const std::string &default_con
/// @todo Do something better here, maybe print the exact error /// @todo Do something better here, maybe print the exact error
// std::cout << "json::Exception: " << e.what() << std::endl; // std::cout << "json::Exception: " << e.what() << std::endl;
delete stream;
stream = new std::istringstream(default_config); stream = new std::istringstream(default_config);
json::Reader::Read(root, *stream); json::Reader::Read(root, *stream);
} }
@ -68,6 +69,10 @@ MRUManager::MRUManager(const std::string &config, const std::string &default_con
MRUManager::~MRUManager() { MRUManager::~MRUManager() {
Flush(); Flush();
for (MRUMap::iterator i = mru.begin(); i != mru.end(); ++i) {
delete i->second;
}
} }