mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
windows/svc: safe closure on error
This commit is contained in:
@@ -152,6 +152,8 @@ func (m *Mgr) CreateService(name, exepath string, c Config, args ...string) (*Se
|
||||
if c.DelayedAutoStart == ServiceDelayedAutoStartTrue {
|
||||
err = updateStartUp(h, c.DelayedAutoStart)
|
||||
if err != nil {
|
||||
windows.DeleteService(h)
|
||||
windows.CloseHandle(h)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user