Skip to content

Commit

Permalink
Crash fix for localmachine collector
Browse files Browse the repository at this point in the history
  • Loading branch information
lkarlslund committed Apr 21, 2022
1 parent 60ded9f commit 20cc4d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/integrations/localmachine/collect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,11 @@ func Collect(outputpath string) error {
var scheduledtasksinfo taskmaster.RegisteredTaskCollection
ts, err := taskmaster.Connect()
if err == nil {
scheduledtasksinfo, _ = ts.GetRegisteredTasks()
defer scheduledtasksinfo.Release()
defer ts.Disconnect()
scheduledtasksinfo, err = ts.GetRegisteredTasks()
if err == nil {
scheduledtasksinfo.Release()
}
ts.Disconnect()
}

// GATHER INTERESTING STUFF FROM EVENT LOG
Expand Down Expand Up @@ -754,5 +756,6 @@ func Collect(outputpath string) error {
return fmt.Errorf("Problem writing to file %v: %v", outputfile, err)
}
log.Info().Msgf("Information collected to file %v", outputfile)

return nil
}

0 comments on commit 20cc4d0

Please sign in to comment.