1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fix most of memleaks discovered by valgrind

This commit is contained in:
Ivan Savenko
2023-11-13 12:09:55 +02:00
parent 1192dbff15
commit 20ef3a69e7
18 changed files with 58 additions and 27 deletions

View File

@@ -700,7 +700,7 @@ void CGameState::initFogOfWar()
int layers = map->levels();
for(auto & elem : teams)
{
auto fow = elem.second.fogOfWarMap;
auto & fow = elem.second.fogOfWarMap;
fow->resize(boost::extents[layers][map->width][map->height]);
std::fill(fow->data(), fow->data() + fow->num_elements(), 0);
@@ -1952,7 +1952,7 @@ bool RumorState::update(int id, int extra)
TeamState::TeamState()
{
setNodeType(TEAM);
fogOfWarMap = std::make_shared<boost::multi_array<ui8, 3>>();
fogOfWarMap = std::make_unique<boost::multi_array<ui8, 3>>();
}
TeamState::TeamState(TeamState && other) noexcept: