about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-07-31 18:39:48 +0200
committeroy <Tom_Adams@web.de>2011-07-31 18:39:48 +0200
commitb25fc26c1cad561bcb4c94a17405058b82dc9e8e (patch)
tree154dd0be23a1c701a12ebd501abff7f1a8f2d939 /src
parent9cf4facd05a07c457d41624390965c801fe4d325 (diff)
downloadzcatch-b25fc26c1cad561bcb4c94a17405058b82dc9e8e.tar.gz
zcatch-b25fc26c1cad561bcb4c94a17405058b82dc9e8e.zip
zero out client memory on startup to prevent more bad surprises
Diffstat (limited to 'src')
-rw-r--r--src/engine/client/client.cpp8
1 files changed, 7 insertions, 1 deletions
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 <new>
 
 #include <stdlib.h> // qsort
 #include <stdarg.h>
@@ -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<CClient *>(mem_alloc(sizeof(CClient), 1));
+	mem_zero(pClient, sizeof(CClient));
+	return new(pClient) CClient;
+}
 
 /*
 	Server Time