From b25fc26c1cad561bcb4c94a17405058b82dc9e8e Mon Sep 17 00:00:00 2001 From: oy Date: Sun, 31 Jul 2011 18:39:48 +0200 Subject: zero out client memory on startup to prevent more bad surprises --- src/engine/client/client.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/engine/client/client.cpp') diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index c8bcc83b..bec7d4d6 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1,5 +1,6 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +#include #include // qsort #include @@ -2165,7 +2166,12 @@ void CClient::RegisterCommands() m_pConsole->Chain("br_filter_serveraddress", ConchainServerBrowserUpdate, this); } -static CClient *CreateClient() { return new CClient(); } +static CClient *CreateClient() +{ + CClient *pClient = static_cast(mem_alloc(sizeof(CClient), 1)); + mem_zero(pClient, sizeof(CClient)); + return new(pClient) CClient; +} /* Server Time -- cgit 1.4.1