From 0f780f6c0bc61294f735f2ccb7209226121e5918 Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Tue, 28 Jun 2022 12:32:52 +0200 Subject: Remember to close the handle in `get_case_sensitive_path` --- src/common/util_windows.odin | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/util_windows.odin b/src/common/util_windows.odin index 194bd4d..716d4be 100644 --- a/src/common/util_windows.odin +++ b/src/common/util_windows.odin @@ -32,10 +32,10 @@ get_case_sensitive_path :: proc(path: string, allocator := context.temp_allocato file := win32.CreateFileW(&wide[0], 0, win32.FILE_SHARE_READ, nil, win32.OPEN_EXISTING, win32.FILE_FLAG_BACKUP_SEMANTICS, nil) if(file == win32.INVALID_HANDLE) - { + { log_last_error() - return ""; - } + return ""; + } buffer := make([]u16, 512, context.temp_allocator) @@ -43,6 +43,8 @@ get_case_sensitive_path :: proc(path: string, allocator := context.temp_allocato res, _ := win32.utf16_to_utf8(buffer[4:], allocator) + win32.CloseHandle(file) + return res } @@ -127,4 +129,4 @@ run_executable :: proc(command: string, stdout: ^[]byte) -> (u32, bool, []byte) win32.CloseHandle(stdout_read) return exit_code, true, stdout[0:index] -} \ No newline at end of file +} -- cgit v1.2.3