From aaf5736a8a3de45bc24861da07622a4044d46fb4 Mon Sep 17 00:00:00 2001 From: guangwu Date: Sat, 11 May 2024 17:17:03 +0800 Subject: [PATCH] fix: close file (#4007) Signed-off-by: guoguangwu --- pkg/ovn_leader_checker/ovn.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/ovn_leader_checker/ovn.go b/pkg/ovn_leader_checker/ovn.go index 197b7e71d84..505e69d7878 100755 --- a/pkg/ovn_leader_checker/ovn.go +++ b/pkg/ovn_leader_checker/ovn.go @@ -189,6 +189,7 @@ func checkNorthdActive() bool { klog.Errorf("failed to open %s err = %v", OvnNorthdPid, err) return false } + defer file.Close() fileByte, err := io.ReadAll(file) if err != nil { klog.Errorf("failed to read %s err = %v", OvnNorthdPid, err)