mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Core/Collision: Fixed possible memory leaks
This commit is contained in:
@@ -264,8 +264,9 @@ namespace VMAP
|
||||
// temporary use defines to simplify read/check code (close file and return at fail)
|
||||
#define READ_OR_RETURN(V, S) if(fread((V), (S), 1, rf) != 1) { \
|
||||
fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++;
|
||||
// only use this for array deletes
|
||||
#define READ_OR_RETURN_WITH_DELETE(V, S) if(fread((V), (S), 1, rf) != 1) { \
|
||||
fclose(rf); printf("readfail, op = %i\n", readOperation); delete V; return(false); }readOperation++;
|
||||
fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }readOperation++;
|
||||
|
||||
#define CMP_OR_RETURN(V, S) if(strcmp((V), (S)) != 0) { \
|
||||
fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); }
|
||||
@@ -334,6 +335,7 @@ namespace VMAP
|
||||
delete[] vectorarray;
|
||||
// drop of temporary use defines
|
||||
#undef READ_OR_RETURN
|
||||
#undef READ_OR_RETURN_WITH_DELETE
|
||||
#undef CMP_OR_RETURN
|
||||
}
|
||||
spawn.iBound = modelBound + spawn.iPos;
|
||||
@@ -375,7 +377,7 @@ namespace VMAP
|
||||
#define READ_OR_RETURN(V, S) if(fread((V), (S), 1, rf) != 1) { \
|
||||
fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++;
|
||||
#define READ_OR_RETURN_WITH_DELETE(V, S) if(fread((V), (S), 1, rf) != 1) { \
|
||||
fclose(rf); printf("readfail, op = %i\n", readOperation); delete V; return(false); }readOperation++;
|
||||
fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }readOperation++;
|
||||
#define CMP_OR_RETURN(V, S) if(strcmp((V), (S)) != 0) { \
|
||||
fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); }
|
||||
|
||||
@@ -482,6 +484,7 @@ namespace VMAP
|
||||
|
||||
// drop of temporary use defines
|
||||
#undef READ_OR_RETURN
|
||||
#undef READ_OR_RETURN_WITH_DELETE
|
||||
#undef CMP_OR_RETURN
|
||||
|
||||
}
|
||||
@@ -490,7 +493,7 @@ namespace VMAP
|
||||
// write WorldModel
|
||||
WorldModel model;
|
||||
model.setRootWmoID(RootWMOID);
|
||||
if (groupsArray.size())
|
||||
if (!groupsArray.empty())
|
||||
{
|
||||
model.setGroupModels(groupsArray);
|
||||
success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo");
|
||||
|
||||
Reference in New Issue
Block a user