fix: close handle leak in hasLocalDnsServerRunning()

Add defer windows.CloseHandle(h) after CreateToolhelp32Snapshot to ensure
the process snapshot handle is properly released on all code paths (match
found, enumeration exhausted, or error).
This commit is contained in:
Codescribe authored and Cuong Manh Le committed 2026-03-25 13:58:24 +07:00
1 parent bd9bb90dd4
commit 112d1cb5a9
1 file changed
+1
+1
View File
@@ -160,6 +160,7 @@ func hasLocalDnsServerRunning() bool {
if e != nil {
return false
}
defer windows.CloseHandle(h)
p := windows.ProcessEntry32{Size: processEntrySize}
for {
e := windows.Process32Next(h, &p)