mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +02:00
Fix 3/4 of issue #327: memory allocation issues.
This commit is contained in:
+6
-6
@@ -36,12 +36,12 @@ namespace love
|
||||
// Convert to UTF-8.
|
||||
int ok = WideCharToMultiByte(CP_UTF8, 0, wstr, wide_len, utf8_str, utf8_size, 0, 0);
|
||||
|
||||
if(!ok)
|
||||
{
|
||||
delete [] utf8_str;
|
||||
}
|
||||
std::string ret;
|
||||
if (ok)
|
||||
ret = utf8_str;
|
||||
|
||||
return ok ? std::string(utf8_str) : std::string();
|
||||
delete utf8_str;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void replace_char(std::string & str, char find, char replace)
|
||||
@@ -57,4 +57,4 @@ namespace love
|
||||
|
||||
} // love
|
||||
|
||||
#endif // LOVE_WINDOWS
|
||||
#endif // LOVE_WINDOWS
|
||||
|
||||
Reference in New Issue
Block a user