Skip to content

Commit a3ae4bc

Browse files
authored
Merge pull request #1221 from shirou/feature/process_win_fix_dup_handle
[process][windows] fix release handle
2 parents fdfd273 + dcac9d9 commit a3ae4bc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

process/process_windows.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,9 @@ func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, er
703703
0, true, windows.DUPLICATE_SAME_ACCESS) != nil {
704704
continue
705705
}
706+
// release the new handle
707+
defer windows.CloseHandle(windows.Handle(file))
708+
706709
fileType, _ := windows.GetFileType(windows.Handle(file))
707710
if fileType != windows.FILE_TYPE_DISK {
708711
continue

0 commit comments

Comments
 (0)