mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
Issue found with PVS-Studio:
Many instances where we would create a object via a new call, and then check that it was non-null. This is redundant, as if we ever were in a situation where new failed, we'd be crashing left and right already, so the additional check is wasted processing.
This commit is contained in:
parent
db532c0e1a
commit
527c3790d6
15 changed files with 164 additions and 262 deletions
|
|
@ -865,11 +865,7 @@ unsigned char *NavMesh::buildTileData(const Tile &tile, TileData &data, U32 &dat
|
|||
}
|
||||
|
||||
unsigned char *areas = new unsigned char[data.geom.getTriCount()];
|
||||
if(!areas)
|
||||
{
|
||||
Con::errorf("Out of memory (area flags) for NavMesh %s", getIdString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dMemset(areas, 0, data.geom.getTriCount() * sizeof(unsigned char));
|
||||
|
||||
// Mark walkable triangles with the appropriate area flags, and rasterize.
|
||||
|
|
|
|||
|
|
@ -72,8 +72,7 @@ U32 RecastPolyList::addPoint(const Point3F &p)
|
|||
else vertcap *= 2;
|
||||
// Allocate new vertex storage.
|
||||
F32 *newverts = new F32[vertcap*3];
|
||||
if(!newverts)
|
||||
return 0;
|
||||
|
||||
dMemcpy(newverts, verts, nverts*3 * sizeof(F32));
|
||||
dFree(verts);
|
||||
verts = newverts;
|
||||
|
|
@ -106,8 +105,7 @@ void RecastPolyList::begin(BaseMatInstance *material, U32 surfaceKey)
|
|||
else tricap *= 2;
|
||||
// Allocate new vertex storage.
|
||||
S32 *newtris = new S32[tricap*3];
|
||||
if(!newtris)
|
||||
return;
|
||||
|
||||
dMemcpy(newtris, tris, ntris*3 * sizeof(S32));
|
||||
dFree(tris);
|
||||
tris = newtris;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue