windows/svc: safe closure on error

This commit is contained in:
utkarsh-extc
2019-07-24 00:28:27 +05:30
committed by GitHub
parent 87093553ba
commit 0c73a916fa

View File

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