Fix memleak pointed by issue #2439.
authorLoic Blot <loic.blot@unix-experience.fr>
Sun, 8 Mar 2015 17:13:27 +0000 (18:13 +0100)
committerLoic Blot <loic.blot@unix-experience.fr>
Sun, 8 Mar 2015 17:13:27 +0000 (18:13 +0100)
Also change bzero to memset. bzero doesn't work on windows

src/client.cpp

index ba6835f513239abb49f668c211e9d5c8af1a863d..e36c04edcca7bf086ee3cdeb1e7ac360cc0436ff 100644 (file)
@@ -401,8 +401,8 @@ void Client::step(float dtime)
 
                        char pName[PLAYERNAME_SIZE];
                        char pPassword[PASSWORD_SIZE];
-                       bzero(pName, PLAYERNAME_SIZE);
-                       bzero(pPassword, PLAYERNAME_SIZE);
+                       memset(pName, 0, PLAYERNAME_SIZE * sizeof(char));
+                       memset(pPassword, 0, PASSWORD_SIZE * sizeof(char));
 
                        snprintf(pName, PLAYERNAME_SIZE, "%s", myplayer->getName());
                        snprintf(pPassword, PASSWORD_SIZE, "%s", m_password.c_str());