Merge pull request #1549 from semarie/clone_to_cstring-leak

delete allocated memory with clone_to_cstring
This commit is contained in:
Jeroen van Rijn
2022-02-24 12:42:15 +01:00
committed by GitHub
4 changed files with 292 additions and 319 deletions
+1 -2
View File
@@ -345,9 +345,8 @@ get_last_error_string :: proc() -> string {
}
open :: proc(path: string, flags: int = O_RDWR, mode: int = 0) -> (Handle, Errno) {
cstr := strings.clone_to_cstring(path)
cstr := strings.clone_to_cstring(path, context.temp_allocator)
handle := _unix_open(cstr, i32(flags), u16(mode))
delete(cstr)
if handle == -1 {
return INVALID_HANDLE, 1
}