Skip to content
Permalink
Browse files
Fix a crash or random memory leak when reseting saved environment var…
…iable in test_servermodmanager.cpp
  • Loading branch information
nerzhul committed Mar 16, 2018
1 parent 478b785 commit e800684ead568b1103f34efbaefaa973f77d46f0
Showing 1 changed file with 6 additions and 2 deletions.
@@ -71,11 +71,15 @@ void TestServerModManager::runTests(IGameDef *gamedef)
#ifdef WIN32
{
std::string subgame_path("MINETEST_SUBGAME_PATH=");
subgame_path.append(saved_env_mt_subgame_path);
if (saved_env_mt_subgame_path)
subgame_path.append(saved_env_mt_subgame_path);
_putenv(subgame_path.c_str());
}
#else
setenv("MINETEST_SUBGAME_PATH", saved_env_mt_subgame_path, 1);
if (saved_env_mt_subgame_path)
setenv("MINETEST_SUBGAME_PATH", saved_env_mt_subgame_path, 1);
else
unsetenv("MINETEST_SUBGAME_PATH");
#endif
}

0 comments on commit e800684

Please sign in to comment.