fix emergemanager memory leaks
authorsapier <Sapier at GMX dot net>
Sun, 7 Apr 2013 19:01:19 +0000 (21:01 +0200)
committerkwolekr <kwolekr@minetest.net>
Tue, 9 Apr 2013 06:34:11 +0000 (02:34 -0400)
src/emerge.cpp
src/map.cpp

index 499aaf291916d962818f1bccd50967e0d957d33b..9d3f94d48428f5d9a97a86af268b7c0783d5592c 100644 (file)
@@ -96,9 +96,23 @@ EmergeManager::~EmergeManager() {
                delete emergethread[i];
                delete mapgen[i];
        }
+       emergethread.clear();
+
+       for (unsigned int i = 0; i < mapgen.size(); i++)
+               delete mapgen[i];
+       mapgen.clear();
+
+       for (unsigned int i = 0; i < ores.size(); i++)
+               delete ores[i];
+       ores.clear();
        
+       for (std::map<std::string, MapgenFactory *>::iterator iter = mglist.begin();
+                       iter != mglist.end(); iter ++) {
+               delete iter->second;
+       }
+       mglist.clear();
+
        delete biomedef;
-       delete params;
 }
 
 
index a8201f3ee7cb0456c050e187e4df231837b8a9a6..c4884a45a12cdc3652ac2da5af01ca6f8943ad80 100644 (file)
@@ -2494,6 +2494,8 @@ ServerMap::~ServerMap()
                delete chunk;
        }
 #endif
+
+       delete m_mgparams;
 }
 
 bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)