From 9ef1d2ed66594cdd7adfb3191d264bfd00796234 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Tue, 16 Feb 2021 08:50:17 +0900 Subject: [PATCH] I'm not really sure why that was failing, but let's copy the binpath just in case... --- src/kuroko.c | 2 +- src/vm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kuroko.c b/src/kuroko.c index 31d71ec..39360b9 100644 --- a/src/kuroko.c +++ b/src/kuroko.c @@ -311,7 +311,7 @@ static void findInterpreter(char * argv[]) { } } if (binpath) { - vm.binpath = binpath; + vm.binpath = strdup(binpath); } /* Else, give up at this point and just don't attach it at all. */ #endif } diff --git a/src/vm.c b/src/vm.c index 63dee33..f8e6808 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1193,7 +1193,7 @@ void krk_initVM(int flags) { krk_attachNamedValue(&vm.system->fields, "module_paths", module_paths); krk_writeValueArray(AS_LIST(module_paths), OBJECT_VAL(S("./"))); if (vm.binpath) { - krk_attachNamedObject(&vm.system->fields, "executable_path", (KrkObj*)krk_takeString(vm.binpath, strlen(vm.binpath))); + krk_attachNamedObject(&vm.system->fields, "executable_path", (KrkObj*)krk_copyString(vm.binpath, strlen(vm.binpath))); char * dir = strdup(vm.binpath); #ifndef _WIN32 char * slash = strrchr(dir,'/');