Skip to content

Commit 0c73a91

Browse files
authored
windows/svc: safe closure on error
1 parent 8709355 commit 0c73a91

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

windows/svc/mgr/mgr.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ func (m *Mgr) CreateService(name, exepath string, c Config, args ...string) (*Se
152152
if c.DelayedAutoStart == ServiceDelayedAutoStartTrue {
153153
err = updateStartUp(h, c.DelayedAutoStart)
154154
if err != nil {
155+
windows.DeleteService(h)
156+
windows.CloseHandle(h)
155157
return nil, err
156158
}
157159
}

0 commit comments

Comments
 (0)