diff --git a/core/os/os2/process.odin b/core/os/os2/process.odin index def561e28..201d4f6e7 100644 --- a/core/os/os2/process.odin +++ b/core/os/os2/process.odin @@ -15,6 +15,9 @@ Arguments to the current process. */ args := get_args() +@(private="file") +internal_args_to_free: []string + @(private="file") get_args :: proc "contextless" () -> []string { context = runtime.default_context() @@ -22,13 +25,16 @@ get_args :: proc "contextless" () -> []string { for rt_arg, i in runtime.args__ { result[i] = string(rt_arg) } + internal_args_to_free = result return result } @(fini, private="file") delete_args :: proc "contextless" () { - context = runtime.default_context() - delete(args, heap_allocator()) + if internal_args_to_free != nil { + context = runtime.default_context() + delete(internal_args_to_free, heap_allocator()) + } } /*