From 3229ded7b16842c189b5b13031b83dd821e6384c Mon Sep 17 00:00:00 2001 From: Jianyu Sun Date: Tue, 8 Aug 2023 17:57:23 +0800 Subject: [PATCH] fix(qrm): fix network plugin possible memory leak (#190) --- pkg/agent/qrm-plugins/network/staticpolicy/policy.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/agent/qrm-plugins/network/staticpolicy/policy.go b/pkg/agent/qrm-plugins/network/staticpolicy/policy.go index e11e64162..20e93ac46 100644 --- a/pkg/agent/qrm-plugins/network/staticpolicy/policy.go +++ b/pkg/agent/qrm-plugins/network/staticpolicy/policy.go @@ -185,8 +185,12 @@ func (p *StaticPolicy) Start() (err error) { p.Lock() defer func() { - if err == nil { - p.started = true + if !p.started { + if err == nil { + p.started = true + } else { + close(p.stopCh) + } } p.Unlock() }()