From 72184c843cd8d9b90e3e7adb7a4faa0a4e4329ad Mon Sep 17 00:00:00 2001 From: Jonathan Como Date: Wed, 9 Mar 2016 16:07:09 -0800 Subject: [PATCH] Free string after converting to value when getting the SystemDirectory --- project/src/ExternalInterface.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 +}