From fbfbb65333490d555fe229e8cad29bf6f6f6a799 Mon Sep 17 00:00:00 2001 From: spiff Date: Thu, 30 Dec 2010 20:38:18 +0100 Subject: fixed: wrong buffer size and mismatching new[]/free usage. part of ticket #10929 --- tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp index 5fc42f1054..c609b9cfb0 100644 --- a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp +++ b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp @@ -183,14 +183,11 @@ void CWiiRemote::SetJoystickMap(const char *JoyMap) free(m_JoyMap); if (JoyMap != NULL) { - m_JoyMap = new char[strlen(JoyMap) + 4]; + m_JoyMap = (char*)malloc(strlen(JoyMap) + 5); sprintf(m_JoyMap, "JS0:%s", JoyMap); } else - { - m_JoyMap = new char[strlen("JS0:WiiRemote")]; - strcpy(m_JoyMap, "JS0:WiiRemote"); - } + m_JoyMap = strdup("JS0:WiiRemote"); } void CWiiRemote::Initialize(CAddress Addr, int Socket) -- cgit v1.2.3