mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix some uninitialized variables, found with valgrind
This commit is contained in:
parent
c4377bb7d9
commit
3116494f6e
|
@ -158,6 +158,7 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
|
|||
while(true)
|
||||
{
|
||||
unsigned char aChunk[1024 * 64];
|
||||
mem_zero(aChunk, sizeof(aChunk));
|
||||
int Bytes = io_read(MapFile, &aChunk, sizeof(aChunk));
|
||||
if(Bytes <= 0)
|
||||
break;
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
#include "econ.h"
|
||||
#include "netban.h"
|
||||
|
||||
CEcon::CEcon() :
|
||||
m_Ready(false)
|
||||
{
|
||||
}
|
||||
|
||||
int CEcon::NewClientCallback(int ClientID, void *pUser)
|
||||
{
|
||||
CEcon *pThis = (CEcon *)pUser;
|
||||
|
|
|
@ -45,6 +45,7 @@ class CEcon
|
|||
static int DelClientCallback(int ClientID, const char *pReason, void *pUser);
|
||||
|
||||
public:
|
||||
CEcon();
|
||||
IConsole *Console() { return m_pConsole; }
|
||||
|
||||
void Init(CConfig *pConfig, IConsole *pConsole, class CNetBan *pNetBan);
|
||||
|
|
|
@ -37,6 +37,7 @@ CStun::CProtocol::CProtocol(int Index, NETSOCKET Socket) :
|
|||
m_Index(Index),
|
||||
m_Socket(Socket)
|
||||
{
|
||||
mem_zero(&m_StunServer, sizeof(NETADDR));
|
||||
// Initialize `m_Stun` with random data.
|
||||
unsigned char aBuf[32];
|
||||
StunMessagePrepare(aBuf, sizeof(aBuf), &m_Stun);
|
||||
|
|
|
@ -635,8 +635,15 @@ int CSaveTeam::FromString(const char *String)
|
|||
m_pSavedTees = 0;
|
||||
}
|
||||
|
||||
if(m_MembersCount)
|
||||
if(m_MembersCount > 64)
|
||||
{
|
||||
dbg_msg("load", "savegame: team has too many players");
|
||||
return 1;
|
||||
}
|
||||
else if(m_MembersCount)
|
||||
{
|
||||
m_pSavedTees = new CSaveTee[m_MembersCount];
|
||||
}
|
||||
|
||||
for(int n = 0; n < m_MembersCount; n++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue