diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index fc3c24188..1031b5622 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -988,7 +988,14 @@ namespace lime { value lime_system_get_directory (int type, HxString company, HxString title) { 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(); + } } @@ -1365,4 +1372,4 @@ extern "C" int lime_register_prims () { return 0; -} \ No newline at end of file +}