diff options
author | sfan5 <sfan5@live.de> | 2014-07-06 16:17:46 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2014-07-06 16:33:02 +0200 |
commit | eadde1e74113ee175708795fc24f8f5d1c746c1d (patch) | |
tree | e6ed75779598a410495a154ae18441ef5949fcb6 /src/gettext.h | |
parent | 6bd15247f91284f7d7869367eafa9064d7f2f727 (diff) | |
download | minetest-eadde1e74113ee175708795fc24f8f5d1c746c1d.tar.gz minetest-eadde1e74113ee175708795fc24f8f5d1c746c1d.tar.bz2 minetest-eadde1e74113ee175708795fc24f8f5d1c746c1d.zip |
Fix errors/warnings reported by valgrind
Diffstat (limited to 'src/gettext.h')
-rw-r--r-- | src/gettext.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gettext.h b/src/gettext.h index 3299f5b25..81510aed6 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -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; |