Skip to content

Commit

Permalink
fix: Missing close statements file.Close() & ticker.Stop()
Browse files Browse the repository at this point in the history
  • Loading branch information
ShuBo6 committed Jul 23, 2024
1 parent 1fa0e2b commit c5a3949
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/pdcp/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (u *UploadWriter) autoCommit(ctx context.Context, r *io.PipeReader) {
// temporary buffer to store the results
buff := &bytes.Buffer{}
ticker := time.NewTicker(flushTimer)

defer ticker.Stop()
for {
select {
case <-ctx.Done():
Expand Down
1 change: 1 addition & 0 deletions pkg/scan/charts/echarts.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func (s *ScanEventsCharts) GenerateHTML(filePath string) error {
if err != nil {
return err
}
defer output.Close()
return page.Render(output)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/scan/events/stats_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func (s *ScanStatsWorker) initEventsFile() error {
if err != nil {
return err
}
defer f.Close()
s.enc = json.NewEncoder(f)
return nil
}
Expand Down

0 comments on commit c5a3949

Please sign in to comment.