Skip to content

Commit

Permalink
Fix thread safety #2
Browse files Browse the repository at this point in the history
  • Loading branch information
noboruma committed Mar 27, 2023
1 parent 466fd72 commit ef8e38e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scan/process_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,6 @@ func ScanSecretsInDirStream(layer string, baseDir string, fullDir string, isFirs
defer close(res)
session := core.GetSession()
maxFileSize := *session.Options.MaximumFileSize * 1024
var file core.MatchFile
var relPath string

walkErr := pwalkdir.WalkN(fullDir, func(path string, f os.DirEntry, err error) error {
if err != nil {
Expand Down Expand Up @@ -336,9 +334,9 @@ func ScanSecretsInDirStream(layer string, baseDir string, fullDir string, isFirs
return nil
}

file = core.NewMatchFile(path)
file := core.NewMatchFile(path)

relPath, err = filepath.Rel(filepath.Join(baseDir, layer), file.Path)
relPath, err := filepath.Rel(filepath.Join(baseDir, layer), file.Path)
if err != nil {
session.Log.Warn("scanSecretsInDir: Couldn't remove prefix of path: %s %s %s",
baseDir, layer, file.Path)
Expand Down

0 comments on commit ef8e38e

Please sign in to comment.