Skip to content

Commit

Permalink
Merge pull request #173 from a-zagaevskiy/master
Browse files Browse the repository at this point in the history
fix handles leakage

Windows API docs states that process handlers should be released:

> When you are finished with the handle, be sure to close it using the [CloseHandle](https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-closehandle) function.

https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-openprocess
  • Loading branch information
Mahmood Ali committed Aug 10, 2021
2 parents 3969aeb + 20881f4 commit d555eeb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions process_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func _pidAlive(pid int) bool {
if err != nil {
return false
}
defer syscall.CloseHandle(h)

var ec uint32
if e := syscall.GetExitCodeProcess(h, &ec); e != nil {
Expand Down

0 comments on commit d555eeb

Please sign in to comment.