- Fix more errors found with static code analysis.

SVN r3288 (trunk)
This commit is contained in:
Randy Heit 2011-09-01 22:57:49 +00:00
parent f8bc459a21
commit 7714ee3ffd
5 changed files with 388 additions and 385 deletions

View file

@ -316,7 +316,7 @@ bool FScriptLoader::ParseInfo(MapData * map)
} }
delete lump; delete[] lump;
return HasScripts; return HasScripts;
} }

View file

@ -1234,7 +1234,7 @@ static bool CheckCachedNodes(MapData *map)
BYTE md5[16]; BYTE md5[16];
BYTE md5map[16]; BYTE md5map[16];
DWORD numlin; DWORD numlin;
DWORD *verts; DWORD *verts = NULL;
FString path = CreateCacheName(map, false); FString path = CreateCacheName(map, false);
FILE *f = fopen(path, "rb"); FILE *f = fopen(path, "rb");
@ -1298,6 +1298,10 @@ static bool CheckCachedNodes(MapData *map)
return true; return true;
errorout: errorout:
if (verts != NULL)
{
delete[] verts;
}
fclose(f); fclose(f);
return false; return false;
} }

View file

@ -3098,7 +3098,6 @@ static void P_GroupLines (bool buildmap)
// set the soundorg to the middle of the bounding box // set the soundorg to the middle of the bounding box
sector->soundorg[0] = bbox.Right()/2 + bbox.Left()/2; sector->soundorg[0] = bbox.Right()/2 + bbox.Left()/2;
sector->soundorg[1] = bbox.Top()/2 + bbox.Bottom()/2; sector->soundorg[1] = bbox.Top()/2 + bbox.Bottom()/2;
sector->soundorg[2] = sector->floorplane.ZatPoint (sector->soundorg[0], sector->soundorg[1]);
} }
delete[] linesDoneInEachSector; delete[] linesDoneInEachSector;
times[3].Unclock(); times[3].Unclock();

View file

@ -445,7 +445,7 @@ bool EV_RotatePoly (line_t *line, int polyNum, int speed, int byteAngle,
Printf ("EV_RotatePoly: Invalid polyobj num: %d\n", polyNum); Printf ("EV_RotatePoly: Invalid polyobj num: %d\n", polyNum);
break; break;
} }
if (poly && poly->specialdata && !overRide) if (poly->specialdata && !overRide)
{ // mirroring poly is already in motion { // mirroring poly is already in motion
break; break;
} }
@ -555,8 +555,8 @@ bool EV_MovePoly (line_t *line, int polyNum, int speed, angle_t angle,
while ( (mirror = poly->GetMirror()) ) while ( (mirror = poly->GetMirror()) )
{ {
poly = PO_GetPolyobj(mirror); poly = PO_GetPolyobj(mirror);
if (poly && poly->specialdata && !overRide) if (poly == NULL || (poly->specialdata != NULL && !overRide))
{ // mirroring poly is already in motion { // mirroring poly does not exist or is already in motion
break; break;
} }
pe = new DMovePoly (mirror); pe = new DMovePoly (mirror);
@ -655,8 +655,8 @@ bool EV_MovePolyTo(line_t *line, int polyNum, int speed, fixed_t targx, fixed_t
while ( (mirror = poly->GetMirror()) ) while ( (mirror = poly->GetMirror()) )
{ {
poly = PO_GetPolyobj(mirror); poly = PO_GetPolyobj(mirror);
if (poly && poly->specialdata && !overRide) if (poly == NULL || (poly->specialdata != NULL && !overRide))
{ // mirroring poly is already in motion { // mirroring poly does not exist or is already in motion
break; break;
} }
// reverse the direction // reverse the direction
@ -841,8 +841,8 @@ bool EV_OpenPolyDoor (line_t *line, int polyNum, int speed, angle_t angle,
while ( (mirror = poly->GetMirror()) ) while ( (mirror = poly->GetMirror()) )
{ {
poly = PO_GetPolyobj (mirror); poly = PO_GetPolyobj (mirror);
if (poly && poly->specialdata) if (poly == NULL || poly->specialdata != NULL)
{ // mirroring poly is already in motion { // mirroring poly does not exist or is already in motion
break; break;
} }
pd = new DPolyDoor (mirror, type); pd = new DPolyDoor (mirror, type);

File diff suppressed because it is too large Load diff