mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix a crash or random memory leak when reseting saved environment variable in test_servermodmanager.cpp
This commit is contained in:
parent
478b785bc8
commit
e800684ead
1 changed files with 6 additions and 2 deletions
|
@ -71,11 +71,15 @@ void TestServerModManager::runTests(IGameDef *gamedef)
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
{
|
{
|
||||||
std::string subgame_path("MINETEST_SUBGAME_PATH=");
|
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());
|
_putenv(subgame_path.c_str());
|
||||||
}
|
}
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue