summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-06-19 10:49:56 +0200
committerarchshift <admin@archshift.com>2014-06-19 10:49:56 +0200
commite8143de01bff31f9e153949d7ab5b0df82629541 (patch)
treed6a37e6433f973765c8ca63e408dbbd420b08d70 /src
parentMerge pull request #1096 from mc-server/redstonerefactor (diff)
downloadcuberite-e8143de01bff31f9e153949d7ab5b0df82629541.tar
cuberite-e8143de01bff31f9e153949d7ab5b0df82629541.tar.gz
cuberite-e8143de01bff31f9e153949d7ab5b0df82629541.tar.bz2
cuberite-e8143de01bff31f9e153949d7ab5b0df82629541.tar.lz
cuberite-e8143de01bff31f9e153949d7ab5b0df82629541.tar.xz
cuberite-e8143de01bff31f9e153949d7ab5b0df82629541.tar.zst
cuberite-e8143de01bff31f9e153949d7ab5b0df82629541.zip
Diffstat (limited to 'src')
-rw-r--r--src/Bindings/ManualBindings.cpp1
-rw-r--r--src/Bindings/PluginLua.cpp1
-rw-r--r--src/Bindings/PluginManager.cpp1
-rw-r--r--src/BlockArea.cpp28
-rw-r--r--src/BlockInfo.cpp1
-rw-r--r--src/ByteBuffer.cpp1
-rw-r--r--src/Chunk.cpp4
-rw-r--r--src/CraftingRecipes.cpp1
-rw-r--r--src/Entities/Player.cpp1
-rw-r--r--src/FurnaceRecipe.cpp4
-rw-r--r--src/Generating/BioGen.cpp2
-rw-r--r--src/Generating/CompoGen.cpp2
-rw-r--r--src/Generating/HeiGen.cpp2
-rw-r--r--src/GroupManager.cpp2
-rw-r--r--src/HTTPServer/HTTPConnection.cpp1
-rw-r--r--src/ItemGrid.cpp1
-rw-r--r--src/Items/ItemBow.h1
-rw-r--r--src/Items/ItemHandler.cpp1
-rw-r--r--src/Items/ItemItemFrame.h1
-rw-r--r--src/MCLogger.cpp1
-rw-r--r--src/Mobs/Blaze.cpp1
-rw-r--r--src/Mobs/Ghast.cpp1
-rw-r--r--src/Mobs/Skeleton.cpp1
-rw-r--r--src/MonsterConfig.cpp1
-rw-r--r--src/Noise.cpp4
-rw-r--r--src/OSSupport/Event.cpp1
-rw-r--r--src/OSSupport/SocketThreads.cpp1
-rw-r--r--src/OSSupport/Thread.cpp2
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp1
-rw-r--r--src/Server.cpp1
-rw-r--r--src/Simulator/FluidSimulator.cpp4
-rw-r--r--src/WebAdmin.cpp1
-rw-r--r--src/World.cpp15
-rw-r--r--src/World.h1
-rw-r--r--src/WorldStorage/WSSCompact.cpp1
35 files changed, 75 insertions, 18 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index acfd6f4f8..f52d970bf 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -1765,6 +1765,7 @@ static int tolua_cWorld_ChunkStay(lua_State * tolua_S)
if (!ChunkStay->AddChunks(2))
{
delete ChunkStay;
+ ChunkStay = NULL;
return 0;
}
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 04639da60..96c5ccde7 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -1571,6 +1571,7 @@ bool cPluginLua::AddHookRef(int a_HookType, int a_FnRefIdx)
LOGWARNING("Plugin %s tried to add a hook %d with bad handler function.", GetName().c_str(), a_HookType);
m_LuaState.LogStackTrace();
delete Ref;
+ Ref = NULL;
return false;
}
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index 9bcd8e3b7..c50100d6f 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -1467,6 +1467,7 @@ void cPluginManager::RemovePlugin(cPlugin * a_Plugin)
a_Plugin->OnDisable();
}
delete a_Plugin;
+ a_Plugin = NULL;
}
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index 4fe6cd51e..185582ba3 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -295,9 +295,9 @@ cBlockArea::~cBlockArea()
void cBlockArea::Clear(void)
{
- delete[] m_BlockTypes; m_BlockTypes = NULL;
- delete[] m_BlockMetas; m_BlockMetas = NULL;
- delete[] m_BlockLight; m_BlockLight = NULL;
+ delete[] m_BlockTypes; m_BlockTypes = NULL;
+ delete[] m_BlockMetas; m_BlockMetas = NULL;
+ delete[] m_BlockLight; m_BlockLight = NULL;
delete[] m_BlockSkyLight; m_BlockSkyLight = NULL;
m_Origin.Set(0, 0, 0);
m_Size.Set(0, 0, 0);
@@ -1013,8 +1013,8 @@ void cBlockArea::RotateCCW(void)
} // for x
std::swap(m_BlockTypes, NewTypes);
std::swap(m_BlockMetas, NewMetas);
- delete[] NewTypes;
- delete[] NewMetas;
+ delete[] NewTypes; NewTypes = NULL;
+ delete[] NewMetas; NewMetas = NULL;
std::swap(m_Size.x, m_Size.z);
}
@@ -1058,8 +1058,8 @@ void cBlockArea::RotateCW(void)
} // for x
std::swap(m_BlockTypes, NewTypes);
std::swap(m_BlockMetas, NewMetas);
- delete[] NewTypes;
- delete[] NewMetas;
+ delete[] NewTypes; NewTypes = NULL;
+ delete[] NewMetas; NewMetas = NULL;
std::swap(m_Size.x, m_Size.z);
}
@@ -1206,7 +1206,7 @@ void cBlockArea::RotateCCWNoMeta(void)
} // for z
} // for x
std::swap(m_BlockTypes, NewTypes);
- delete[] NewTypes;
+ delete[] NewTypes; NewTypes = NULL;
}
if (HasBlockMetas())
{
@@ -1224,7 +1224,7 @@ void cBlockArea::RotateCCWNoMeta(void)
} // for z
} // for x
std::swap(m_BlockMetas, NewMetas);
- delete[] NewMetas;
+ delete[] NewMetas; NewMetas = NULL;
}
std::swap(m_Size.x, m_Size.z);
}
@@ -1251,7 +1251,7 @@ void cBlockArea::RotateCWNoMeta(void)
} // for x
} // for z
std::swap(m_BlockTypes, NewTypes);
- delete[] NewTypes;
+ delete[] NewTypes; NewTypes = NULL;
}
if (HasBlockMetas())
{
@@ -1269,7 +1269,7 @@ void cBlockArea::RotateCWNoMeta(void)
} // for x
} // for z
std::swap(m_BlockMetas, NewMetas);
- delete[] NewMetas;
+ delete[] NewMetas; NewMetas = NULL;
}
std::swap(m_Size.x, m_Size.z);
}
@@ -1658,6 +1658,7 @@ bool cBlockArea::SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes)
if (m_BlockMetas == NULL)
{
delete[] m_BlockTypes;
+ m_BlockTypes = NULL;
return false;
}
}
@@ -1667,7 +1668,9 @@ bool cBlockArea::SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes)
if (m_BlockLight == NULL)
{
delete[] m_BlockMetas;
+ m_BlockMetas = NULL;
delete[] m_BlockTypes;
+ m_BlockTypes = NULL;
return false;
}
}
@@ -1677,8 +1680,11 @@ bool cBlockArea::SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes)
if (m_BlockSkyLight == NULL)
{
delete[] m_BlockLight;
+ m_BlockLight = NULL;
delete[] m_BlockMetas;
+ m_BlockMetas = NULL;
delete[] m_BlockTypes;
+ m_BlockTypes = NULL;
return false;
}
}
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index 564b3fcca..32fdec905 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -34,6 +34,7 @@ cBlockInfo::cBlockInfo()
cBlockInfo::~cBlockInfo()
{
delete m_Handler;
+ m_Handler = NULL;
}
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index d77f402fd..1a69c856f 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -165,6 +165,7 @@ cByteBuffer::~cByteBuffer()
{
CheckValid();
delete[] m_Buffer;
+ m_Buffer = NULL;
}
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 4703e4536..6ab49036d 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -152,7 +152,9 @@ cChunk::~cChunk()
m_NeighborZP->m_NeighborZM = NULL;
}
delete m_WaterSimulatorData;
+ m_WaterSimulatorData = NULL;
delete m_LavaSimulatorData;
+ m_LavaSimulatorData = NULL;
}
@@ -596,6 +598,7 @@ void cChunk::Tick(float a_Dt)
cEntity * ToDelete = *itr;
itr = m_Entities.erase(itr);
delete ToDelete;
+ ToDelete = NULL;
continue;
}
++itr;
@@ -1417,6 +1420,7 @@ void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType,
BlockEntity->Destroy();
RemoveBlockEntity(BlockEntity);
delete BlockEntity;
+ BlockEntity = NULL;
}
// If the new block is a block entity, create the entity object:
diff --git a/src/CraftingRecipes.cpp b/src/CraftingRecipes.cpp
index 53a638ee5..0f1951351 100644
--- a/src/CraftingRecipes.cpp
+++ b/src/CraftingRecipes.cpp
@@ -59,6 +59,7 @@ cCraftingGrid::cCraftingGrid(const cCraftingGrid & a_Original) :
cCraftingGrid::~cCraftingGrid()
{
delete[] m_Items;
+ m_Items = NULL;
}
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index fdc0bb390..e1e03fded 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -146,6 +146,7 @@ cPlayer::~cPlayer(void)
m_ClientHandle = NULL;
delete m_InventoryWindow;
+ m_InventoryWindow = NULL;
LOGD("Player %p deleted", this);
}
diff --git a/src/FurnaceRecipe.cpp b/src/FurnaceRecipe.cpp
index bd7fd8079..2cb204ccf 100644
--- a/src/FurnaceRecipe.cpp
+++ b/src/FurnaceRecipe.cpp
@@ -42,6 +42,7 @@ cFurnaceRecipe::~cFurnaceRecipe()
{
ClearRecipes();
delete m_pState;
+ m_pState = NULL;
}
@@ -187,7 +188,9 @@ void cFurnaceRecipe::ClearRecipes(void)
{
Recipe R = *itr;
delete R.In;
+ R.In = NULL;
delete R.Out;
+ R.Out = NULL;
}
m_pState->Recipes.clear();
@@ -195,6 +198,7 @@ void cFurnaceRecipe::ClearRecipes(void)
{
Fuel F = *itr;
delete F.In;
+ F.In = NULL;
}
m_pState->Fuel.clear();
}
diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp
index 47ba080c6..3e3a034b2 100644
--- a/src/Generating/BioGen.cpp
+++ b/src/Generating/BioGen.cpp
@@ -135,7 +135,9 @@ cBioGenCache::cBioGenCache(cBiomeGen * a_BioGenToCache, int a_CacheSize) :
cBioGenCache::~cBioGenCache()
{
delete[] m_CacheData;
+ m_CacheData = NULL;
delete[] m_CacheOrder;
+ m_CacheOrder = NULL;
}
diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp
index 688d19c40..2da285d72 100644
--- a/src/Generating/CompoGen.cpp
+++ b/src/Generating/CompoGen.cpp
@@ -672,7 +672,9 @@ cCompoGenCache::cCompoGenCache(cTerrainCompositionGen & a_Underlying, int a_Cach
cCompoGenCache::~cCompoGenCache()
{
delete[] m_CacheData;
+ m_CacheData = NULL;
delete[] m_CacheOrder;
+ m_CacheOrder = NULL;
}
diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp
index 25ac912fd..202f7db7e 100644
--- a/src/Generating/HeiGen.cpp
+++ b/src/Generating/HeiGen.cpp
@@ -142,7 +142,9 @@ cHeiGenCache::cHeiGenCache(cTerrainHeightGen & a_HeiGenToCache, int a_CacheSize)
cHeiGenCache::~cHeiGenCache()
{
delete[] m_CacheData;
+ m_CacheData = NULL;
delete[] m_CacheOrder;
+ m_CacheOrder = NULL;
}
diff --git a/src/GroupManager.cpp b/src/GroupManager.cpp
index e570bb2b1..11e62c223 100644
--- a/src/GroupManager.cpp
+++ b/src/GroupManager.cpp
@@ -30,10 +30,12 @@ cGroupManager::~cGroupManager()
for( GroupMap::iterator itr = m_pState->Groups.begin(); itr != m_pState->Groups.end(); ++itr )
{
delete itr->second;
+ itr->second = NULL;
}
m_pState->Groups.clear();
delete m_pState;
+ m_pState = NULL;
}
diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp
index b127e7091..21ff14373 100644
--- a/src/HTTPServer/HTTPConnection.cpp
+++ b/src/HTTPServer/HTTPConnection.cpp
@@ -28,6 +28,7 @@ cHTTPConnection::~cHTTPConnection()
{
// LOGD("HTTP: Connection deleting: %p", this);
delete m_CurrentRequest;
+ m_CurrentRequest = NULL;
}
diff --git a/src/ItemGrid.cpp b/src/ItemGrid.cpp
index 34a267bab..cd36b1f2a 100644
--- a/src/ItemGrid.cpp
+++ b/src/ItemGrid.cpp
@@ -28,6 +28,7 @@ cItemGrid::cItemGrid(int a_Width, int a_Height) :
cItemGrid::~cItemGrid()
{
delete[] m_Slots;
+ m_Slots = NULL;
}
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h
index e0ab339d3..821e2ab26 100644
--- a/src/Items/ItemBow.h
+++ b/src/Items/ItemBow.h
@@ -69,6 +69,7 @@ public:
if (!Arrow->Initialize(*a_Player->GetWorld()))
{
delete Arrow;
+ Arrow = NULL;
return;
}
a_Player->GetWorld()->BroadcastSpawnEntity(*Arrow);
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index d97f986ba..f639423ae 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -260,6 +260,7 @@ void cItemHandler::Deinit()
for(int i = 0; i < 2267; i++)
{
delete m_ItemHandler[i];
+ m_ItemHandler[i] = NULL;
}
memset(m_ItemHandler, 0, sizeof(m_ItemHandler)); // Don't leave any dangling pointers around, just in case
m_HandlerInitialized = false;
diff --git a/src/Items/ItemItemFrame.h b/src/Items/ItemItemFrame.h
index 097f04d0b..b258b4aea 100644
--- a/src/Items/ItemItemFrame.h
+++ b/src/Items/ItemItemFrame.h
@@ -37,6 +37,7 @@ public:
if (!ItemFrame->Initialize(*a_World))
{
delete ItemFrame;
+ ItemFrame = NULL;
return false;
}
diff --git a/src/MCLogger.cpp b/src/MCLogger.cpp
index 583438d65..ad2029589 100644
--- a/src/MCLogger.cpp
+++ b/src/MCLogger.cpp
@@ -57,6 +57,7 @@ cMCLogger::~cMCLogger()
{
m_Log->Log("--- Stopped Log ---\n");
delete m_Log;
+ m_Log = NULL;
if (this == s_MCLogger)
{
s_MCLogger = NULL;
diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp
index 19bdf8737..b4104d530 100644
--- a/src/Mobs/Blaze.cpp
+++ b/src/Mobs/Blaze.cpp
@@ -47,6 +47,7 @@ void cBlaze::Attack(float a_Dt)
if (!FireCharge->Initialize(*m_World))
{
delete FireCharge;
+ FireCharge = NULL;
return;
}
m_World->BroadcastSpawnEntity(*FireCharge);
diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp
index 4df8e165c..6aac14779 100644
--- a/src/Mobs/Ghast.cpp
+++ b/src/Mobs/Ghast.cpp
@@ -49,6 +49,7 @@ void cGhast::Attack(float a_Dt)
if (!GhastBall->Initialize(*m_World))
{
delete GhastBall;
+ GhastBall = NULL;
return;
}
m_World->BroadcastSpawnEntity(*GhastBall);
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index e7f3971cc..e3357185d 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -84,6 +84,7 @@ void cSkeleton::Attack(float a_Dt)
if (!Arrow->Initialize(*m_World))
{
delete Arrow;
+ Arrow = NULL;
return;
}
m_World->BroadcastSpawnEntity(*Arrow);
diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp
index 72a3a3245..f5e746ce8 100644
--- a/src/MonsterConfig.cpp
+++ b/src/MonsterConfig.cpp
@@ -47,6 +47,7 @@ cMonsterConfig::cMonsterConfig(void)
cMonsterConfig::~cMonsterConfig()
{
delete m_pState;
+ m_pState = NULL;
}
diff --git a/src/Noise.cpp b/src/Noise.cpp
index 040421106..fbd2a1800 100644
--- a/src/Noise.cpp
+++ b/src/Noise.cpp
@@ -877,6 +877,7 @@ void cPerlinNoise::Generate2D(
if (ShouldFreeWorkspace)
{
delete[] a_Workspace;
+ a_Workspace = NULL;
}
}
@@ -943,6 +944,7 @@ void cPerlinNoise::Generate3D(
if (ShouldFreeWorkspace)
{
delete[] a_Workspace;
+ a_Workspace = NULL;
}
}
@@ -1045,6 +1047,7 @@ void cRidgedMultiNoise::Generate2D(
if (ShouldFreeWorkspace)
{
delete[] a_Workspace;
+ a_Workspace = NULL;
}
}
@@ -1111,6 +1114,7 @@ void cRidgedMultiNoise::Generate3D(
if (ShouldFreeWorkspace)
{
delete[] a_Workspace;
+ a_Workspace = NULL;
}
}
diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp
index 649a0a3cf..6b8fccde2 100644
--- a/src/OSSupport/Event.cpp
+++ b/src/OSSupport/Event.cpp
@@ -71,6 +71,7 @@ cEvent::~cEvent()
{
sem_destroy(m_Event);
delete m_Event;
+ m_Event = NULL;
}
#endif
}
diff --git a/src/OSSupport/SocketThreads.cpp b/src/OSSupport/SocketThreads.cpp
index 0ab5b6298..ca8b8438d 100644
--- a/src/OSSupport/SocketThreads.cpp
+++ b/src/OSSupport/SocketThreads.cpp
@@ -61,6 +61,7 @@ bool cSocketThreads::AddClient(const cSocket & a_Socket, cCallback * a_Client)
// There was an error launching the thread (but it was already logged along with the reason)
LOGERROR("A new cSocketThread failed to start");
delete Thread;
+ Thread = NULL;
return false;
}
Thread->AddClient(a_Socket, a_Client);
diff --git a/src/OSSupport/Thread.cpp b/src/OSSupport/Thread.cpp
index 7a10ef8d2..535784613 100644
--- a/src/OSSupport/Thread.cpp
+++ b/src/OSSupport/Thread.cpp
@@ -66,11 +66,13 @@ cThread::cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_Thre
cThread::~cThread()
{
delete m_Event;
+ m_Event = NULL;
if( m_StopEvent )
{
m_StopEvent->Wait();
delete m_StopEvent;
+ m_StopEvent = NULL;
}
}
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index 35a331f43..80f5da25a 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -37,6 +37,7 @@ cProtocolRecognizer::cProtocolRecognizer(cClientHandle * a_Client) :
cProtocolRecognizer::~cProtocolRecognizer()
{
delete m_Protocol;
+ m_Protocol = NULL;
}
diff --git a/src/Server.cpp b/src/Server.cpp
index 66bccd680..2c695cc70 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -326,6 +326,7 @@ void cServer::OnConnectionAccepted(cSocket & a_Socket)
LOGERROR("Client \"%s\" cannot be handled, server probably unstable", ClientIP.c_str());
a_Socket.CloseSocket();
delete NewHandle;
+ NewHandle = NULL;
return;
}
diff --git a/src/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp
index 4a84084d2..f64955cb2 100644
--- a/src/Simulator/FluidSimulator.cpp
+++ b/src/Simulator/FluidSimulator.cpp
@@ -169,7 +169,8 @@ Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a
X = Pos->x;
Z = Pos->z;
}
- }else if(BlockID == E_BLOCK_AIR)
+ }
+ else if(BlockID == E_BLOCK_AIR)
{
LowestPoint = 9; //This always dominates
X = Pos->x;
@@ -177,6 +178,7 @@ Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a
}
delete Pos;
+ Pos = NULL;
}
if (LowestPoint == m_World.GetBlockMeta(a_X, a_Y, a_Z))
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index 08e164d78..d80849433 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -524,6 +524,7 @@ void cWebAdmin::OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest &
// Delete any request data assigned to the request:
cRequestData * Data = (cRequestData *)(a_Request.GetUserData());
delete Data;
+ Data = NULL;
}
diff --git a/src/World.cpp b/src/World.cpp
index 6bcd1391a..5b067b386 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -267,12 +267,12 @@ cWorld::cWorld(const AString & a_WorldName) :
cWorld::~cWorld()
{
- delete m_SimulatorManager;
- delete m_SandSimulator;
- delete m_WaterSimulator;
- delete m_LavaSimulator;
- delete m_FireSimulator;
- delete m_RedstoneSimulator;
+ delete m_SimulatorManager; m_SimulatorManager = NULL;
+ delete m_SandSimulator; m_SandSimulator = NULL;
+ delete m_WaterSimulator; m_WaterSimulator = NULL;
+ delete m_LavaSimulator; m_LavaSimulator = NULL;
+ delete m_FireSimulator; m_FireSimulator = NULL;
+ delete m_RedstoneSimulator; m_RedstoneSimulator = NULL;
UnloadUnusedChunks();
@@ -2972,11 +2972,13 @@ int cWorld::SpawnMobFinalize(cMonster * a_Monster)
if (cPluginManager::Get()->CallHookSpawningMonster(*this, *a_Monster))
{
delete a_Monster;
+ a_Monster = NULL;
return -1;
}
if (!a_Monster->Initialize(*this))
{
delete a_Monster;
+ a_Monster = NULL;
return -1;
}
BroadcastSpawnEntity(*a_Monster);
@@ -2999,6 +3001,7 @@ int cWorld::CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProje
if (!Projectile->Initialize(*this))
{
delete Projectile;
+ Projectile = NULL;
return -1;
}
return Projectile->GetUniqueID();
diff --git a/src/World.h b/src/World.h
index f638b4b22..2b7f78760 100644
--- a/src/World.h
+++ b/src/World.h
@@ -830,6 +830,7 @@ private:
virtual ~cScheduledTask()
{
delete m_Task;
+ m_Task = NULL;
}
};
diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp
index 7a113849a..a853f6ec9 100644
--- a/src/WorldStorage/WSSCompact.cpp
+++ b/src/WorldStorage/WSSCompact.cpp
@@ -473,6 +473,7 @@ cWSSCompact::cPAKFile::cPAKFile(const AString & a_FileName, int a_LayerX, int a_
{
LOGERROR("ERROR READING %s FROM FILE %s (line %d); file offset %d", "Header", m_FileName.c_str(), __LINE__, f.Tell());
delete Header;
+ Header = NULL;
return;
}
m_ChunkHeaders.push_back(Header);