mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-05 03:03:40 +00:00
Merge pull request #100326 from wzshiming/fix/memory-leak
Fix watchForLockfileContention memory leak
This commit is contained in:
@@ -29,6 +29,7 @@ func watchForLockfileContention(path string, done chan struct{}) error {
|
||||
}
|
||||
if err = watcher.AddWatch(path, inotify.InOpen|inotify.InDeleteSelf); err != nil {
|
||||
klog.ErrorS(err, "Unable to watch lockfile")
|
||||
watcher.Close()
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
@@ -39,6 +40,7 @@ func watchForLockfileContention(path string, done chan struct{}) error {
|
||||
klog.ErrorS(err, "inotify watcher error")
|
||||
}
|
||||
close(done)
|
||||
watcher.Close()
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user