Fixed memory leak on game re-init.

This commit is contained in:
Oliver Hamlet
2014-12-25 00:09:42 +00:00
parent 7b616b141c
commit c635d6bad0
+6
View File
@@ -476,6 +476,12 @@ namespace loot {
if (!localAppData.empty())
gameLocalDataPath = localAppData.c_str();
// If the handle has already been initialised, close it and open another.
if (gh != nullptr) {
lo_destroy_handle(gh);
gh = nullptr;
}
int ret;
if (Id() == Game::tes4)
ret = lo_create_handle(&gh, LIBLO_GAME_TES4, gamePath.string().c_str(), gameLocalDataPath);