Stop timer in function waitPidStop

Because it will cause memory leak if we do not stop timer when the function has completed.

[NO NEW TESTS NEEDED]

Signed-off-by: hang.jiang <hang.jiang@daocloud.io>
This commit is contained in:
hang.jiang 2023-08-07 18:28:17 +08:00
parent 2e97c6616d
commit 282594e58f
1 changed files with 1 additions and 0 deletions

View File

@ -1000,6 +1000,7 @@ func waitContainerStop(ctr *Container, timeout time.Duration) error {
// Wait for a given PID to stop
func waitPidStop(pid int, timeout time.Duration) error {
timer := time.NewTimer(timeout)
defer timer.Stop()
for {
select {
case <-timer.C: