Skip to content

Commit

Permalink
Add close to Start() so that failed starts don't create resource leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
vjsamuel committed Jul 1, 2020
1 parent ae44ee5 commit f293c68
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions auditbeat/module/file_integrity/eventreader_fsnotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (r *reader) Start(done <-chan struct{}) (<-chan Event, error) {

r.watcher = watcher
if err := r.watcher.Start(); err != nil {
// Ensure that watcher is closed so that we don't leak watchers
r.watcher.Close()
return nil, errors.Wrap(err, "unable to start watcher")
}

Expand Down

0 comments on commit f293c68

Please sign in to comment.