Fix memory leak in os.get_current_directory on failure on *nix systems

This commit is contained in:
gingerBill
2023-01-16 15:29:45 +00:00
parent 7416f72565
commit b6ca10cd5e
4 changed files with 4 additions and 0 deletions
+1
View File
@@ -649,6 +649,7 @@ get_current_directory :: proc() -> string {
return string(cwd)
}
if Errno(get_last_error()) != ERANGE {
delete(buf)
return ""
}
resize(&buf, len(buf) + MAX_PATH)