From 8bf8ae1cb32e5f0312d9f8759ccbcec797890827 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez-Fernandez Date: Tue, 2 Apr 2024 06:48:07 -0700 Subject: [PATCH] fix no unlock upon error Signed-off-by: Carlos Rodriguez-Fernandez --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 9fba938..89401f6 100644 --- a/main.go +++ b/main.go @@ -153,6 +153,7 @@ func (s *smokePingers) prepare(hosts *[]string, interval *time.Duration, privile maxInterval := *interval sc.Lock() + defer sc.Unlock() for _, targetGroup := range sc.C.Targets { packetSize := targetGroup.Size if packetSize < 24 || packetSize > 65535 { @@ -178,7 +179,6 @@ func (s *smokePingers) prepare(hosts *[]string, interval *time.Duration, privile pingers = append(pingers, pinger) } } - sc.Unlock() s.prepared = pingers s.maxInterval = maxInterval return nil