Merge pull request #701 from rocket-games/fix-system-dir-mem-leak

Fix system dir string leak
This commit is contained in:
Joshua Granick
2016-03-14 09:35:15 -07:00

View File

@@ -1157,7 +1157,14 @@ namespace lime {
value lime_system_get_directory (int type, HxString company, HxString title) { value lime_system_get_directory (int type, HxString company, HxString title) {
const char* path = System::GetDirectory ((SystemDirectory)type, company.__s, title.__s); const char* path = System::GetDirectory ((SystemDirectory)type, company.__s, title.__s);
return path ? alloc_string (path) : alloc_null ();
if (path) {
value dirPath = alloc_string(path);
free((char *)dirPath);
return dirPath;
} else {
return alloc_null();
}
} }
@@ -1609,4 +1616,4 @@ extern "C" int lime_register_prims () {
return 0; return 0;
} }