fix address sanitizer issues

This commit is contained in:
nillerusr
2022-04-25 17:21:00 +03:00
parent a5e9cdcbe2
commit 2ec2a47a53
17 changed files with 43 additions and 37 deletions
+1 -1
View File
@@ -893,7 +893,7 @@ CON_COMMAND_F( connect, "Connect to specified server.", FCVAR_DONTRECORD )
{
ConMsg( "Usage: connect <server>\n" );
}
vecArgs.PurgeAndDeleteElements();
vecArgs.PurgeAndDeleteElementsArray();
}
CON_COMMAND_F( redirect, "Redirect client to specified server.", FCVAR_DONTRECORD | FCVAR_SERVER_CAN_EXECUTE )
+3
View File
@@ -2677,6 +2677,9 @@ int CM_BoxVisible( const Vector& mins, const Vector& maxs, const byte *visbi
int cluster = CM_LeafCluster( leafList[i] );
int offset = cluster>>3;
if( offset == -1 )
return true;
if ( offset > vissize )
{
Sys_Error( "CM_BoxVisible: cluster %i, offset %i out of bounds %i\n", cluster, offset, vissize );
+2 -2
View File
@@ -52,7 +52,7 @@ public:
{
if ( pData )
{
delete pData;
delete[] pData;
}
}
@@ -65,7 +65,7 @@ public:
pSendTable = src.pSendTable;
pClientClass = src.pClientClass;
filter.AddPlayersFromFilter( &src.filter );
if ( src.pData )
{
int size = Bits2Bytes( src.bits );
+2 -1
View File
@@ -806,7 +806,8 @@ int CSaveRestore::SaveGameSlot( const char *pSaveName, const char *pSaveComment,
m_bWaitingForSafeDangerousSave = bIsAutosaveDangerous;
int iHeaderBufferSize = 64 + tokenSize + pSaveData->GetCurPos();
void *pMem = malloc(iHeaderBufferSize);
void *pMem = new char[iHeaderBufferSize];
CUtlBuffer saveHeader( pMem, iHeaderBufferSize );
// Write the header -- THIS SHOULD NEVER CHANGE STRUCTURE, USE SAVE_HEADER FOR NEW HEADER INFORMATION
+1 -1
View File
@@ -1389,7 +1389,7 @@ bool NET_GetLoopPacket ( netpacket_t * packet )
if ( loop->data != loop->defbuffer )
{
delete loop->data;
delete[] loop->data;
loop->data = loop->defbuffer;
}
+8 -8
View File
@@ -2048,34 +2048,34 @@ public:
class CClipPlane
{
public:
static inline bool Inside( ShadowVertex_t const& vert )
static inline bool Inside( ShadowVertex_t const& vert )
{
return DotProduct( vert.m_Position, *m_pNormal ) < m_Dist;
return DotProduct( vert.m_Position, m_pNormal ) < m_Dist;
}
static inline float Clip( const Vector& one, const Vector& two )
static inline float Clip( const Vector& one, const Vector& two )
{
Vector dir;
VectorSubtract( two, one, dir );
return IntersectRayWithPlane( one, dir, *m_pNormal, m_Dist );
return IntersectRayWithPlane( one, dir, m_pNormal, m_Dist );
}
static inline bool IsAbove() {return false;}
static inline bool IsPlane() {return true;}
static void SetPlane( const Vector& normal, float dist )
static void SetPlane( const Vector normal, float dist )
{
m_pNormal = &normal;
m_pNormal = normal;
m_Dist = dist;
}
private:
static const Vector *m_pNormal;
static const Vector m_pNormal;
static float m_Dist;
};
const Vector *CClipPlane::m_pNormal;
const Vector CClipPlane::m_pNormal;
float CClipPlane::m_Dist;
static inline void ClampTexCoord( ShadowVertex_t *pInVertex, ShadowVertex_t *pOutVertex )
+2 -2
View File
@@ -2297,9 +2297,9 @@ void CVoxelTree::EnumerateElementsAlongRay( SpatialPartitionListMask_t listMask,
vecInvDelta[1] = ( clippedRay.m_Delta[1] != 0.0f ) ? 1.0f / clippedRay.m_Delta[1] : FLT_MAX;
vecInvDelta[2] = ( clippedRay.m_Delta[2] != 0.0f ) ? 1.0f / clippedRay.m_Delta[2] : FLT_MAX;
CPartitionVisits *pPrevVisits = BeginVisit();
m_lock.LockForRead();
CPartitionVisits *pPrevVisits = BeginVisit();
if ( ray.m_IsRay )
{
EnumerateElementsAlongRay_Ray( listMask, clippedRay, vecInvDelta, vecEnd, pIterator );