1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix errors/warnings reported by valgrind

This commit is contained in:
sfan5 2014-07-06 16:17:46 +02:00
parent 6bd15247f9
commit eadde1e741
4 changed files with 32 additions and 32 deletions

View file

@ -68,12 +68,12 @@ inline wchar_t* chartowchar_t(const char *str)
MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) str, -1, (WCHAR *) nstr, nResult );
}
#else
size_t l = strlen(str)+1;
nstr = new wchar_t[l];
size_t l = strlen(str);
nstr = new wchar_t[l+1];
std::wstring intermediate = narrow_to_wide(str);
memset(nstr,0,l);
memcpy(nstr,intermediate.c_str(),l*sizeof(wchar_t));
memset(nstr, 0, (l+1)*sizeof(wchar_t));
memcpy(nstr, intermediate.c_str(), l*sizeof(wchar_t));
#endif
return nstr;