Skip to content

Commit fa7329f

Browse files
authored
fix: race condition of the lastmatcherevent (#6080)
1 parent 99f8df3 commit fa7329f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/tmplexec/exec.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,10 @@ func (e *TemplateExecuter) Execute(ctx *scan.ScanContext) (bool, error) {
215215

216216
if lastMatcherEvent != nil {
217217
lastMatcherEvent.Lock()
218+
defer lastMatcherEvent.Unlock()
219+
218220
lastMatcherEvent.InternalEvent["error"] = getErrorCause(ctx.GenerateErrorMessage())
219-
lastMatcherEvent.Unlock()
221+
220222
writeFailureCallback(lastMatcherEvent, e.options.Options.MatcherStatus)
221223
}
222224

0 commit comments

Comments
 (0)