Fix memory leak in System.applicationDirectory/applicationStorageDirectory

This commit is contained in:
Joshua Granick
2017-02-11 13:54:49 -08:00
parent cdd9a29311
commit 8d90ae2af6

View File

@@ -94,8 +94,9 @@ namespace lime {
case APPLICATION: {
std::string path = std::string (SDL_GetBasePath ());
std::wstring* result = new std::wstring (path.begin (), path.end ());
char* path = SDL_GetBasePath ();
std::wstring* result = new std::wstring (path, path + strlen (path));
SDL_free (path);
return result;
break;
@@ -103,8 +104,9 @@ namespace lime {
case APPLICATION_STORAGE: {
std::string path = std::string (SDL_GetPrefPath (company, title));
std::wstring* result = new std::wstring (path.begin (), path.end ());
char* path = SDL_GetPrefPath (company, title);
std::wstring* result = new std::wstring (path, path + strlen (path));
SDL_free (path);
return result;
break;