Skip to content

Commit c9b94f9

Browse files
author
Corbin Phelps
committed
Fixed ticker leak in waitForSocket when starting a VM
1 parent b000873 commit c9b94f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

machine.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,14 @@ func (m *Machine) refreshMachineConfiguration() error {
723723
// waitForSocket waits for the given file to exist
724724
func (m *Machine) waitForSocket(timeout time.Duration, exitchan chan error) error {
725725
ctx, cancel := context.WithTimeout(context.Background(), timeout)
726-
defer cancel()
727726

728727
ticker := time.NewTicker(10 * time.Millisecond)
729728

729+
defer func() {
730+
cancel()
731+
ticker.Stop()
732+
}()
733+
730734
for {
731735
select {
732736
case <-ctx.Done():

0 commit comments

Comments
 (0)