From dcac9d9b010d2e0979a079b00b691240ab7c655d Mon Sep 17 00:00:00 2001 From: shirou Date: Thu, 6 Jan 2022 22:16:57 +0900 Subject: [PATCH] [process][windows] fix release handle --- process/process_windows.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/process/process_windows.go b/process/process_windows.go index 282b0d9..d348946 100644 --- a/process/process_windows.go +++ b/process/process_windows.go @@ -703,6 +703,9 @@ func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, er 0, true, windows.DUPLICATE_SAME_ACCESS) != nil { continue } + // release the new handle + defer windows.CloseHandle(windows.Handle(file)) + fileType, _ := windows.GetFileType(windows.Handle(file)) if fileType != windows.FILE_TYPE_DISK { continue