From 5043fc87566b949e955b297b706dc29cb2e2e145 Mon Sep 17 00:00:00 2001 From: ahrav Date: Mon, 31 Jul 2023 14:06:41 -0700 Subject: [PATCH] [bug] - Fix unlocking an unlocked mutex (#1583) * use correct mutext. * remove unused fxn. --- pkg/engine/engine.go | 4 ---- pkg/sources/github/repo.go | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index b4fda8918a02..68c912d17722 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -176,10 +176,6 @@ func filterDetectors(filterFunc func(detectors.Detector) bool, input []detectors return output } -func (e *Engine) setFoundResults() { - atomic.StoreUint32(&e.numFoundResults, 1) -} - // HasFoundResults returns true if any results are found. func (e *Engine) HasFoundResults() bool { return atomic.LoadUint32(&e.numFoundResults) > 0 diff --git a/pkg/sources/github/repo.go b/pkg/sources/github/repo.go index c0c7709d0055..502a897970cd 100644 --- a/pkg/sources/github/repo.go +++ b/pkg/sources/github/repo.go @@ -65,7 +65,7 @@ func (s *Source) cloneRepo( func (s *Source) getUserAndToken(ctx context.Context, repoURL string, installationClient *github.Client) error { // We never refresh user provided tokens, so if we already have them, we never need to try and fetch them again. s.userMu.Lock() - defer s.mu.Unlock() + defer s.userMu.Unlock() if s.githubUser == "" || s.githubToken == "" { var err error s.githubUser, s.githubToken, err = s.userAndToken(ctx, installationClient)