1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-05-02 22:17:08 +08:00

Merge pull request #1221 from shirou/feature/process_win_fix_dup_handle

[process][windows] fix release handle
This commit is contained in:
shirou 2022-01-06 22:24:23 +09:00 committed by GitHub
commit a3ae4bc40d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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