From f4ec565b44905fc8dd4d932a719b8425c8e5ea17 Mon Sep 17 00:00:00 2001 From: Yakiv Huryk <62013282+Yakiv-Huryk@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:09:14 +0300 Subject: [PATCH] [vlanmgrd] fix use-after-free memory issue (#2211) * reordered the code so the reference to a deleted object (t) is not used Signed-off-by: Yakiv Huryk --- cfgmgr/vlanmgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfgmgr/vlanmgr.cpp b/cfgmgr/vlanmgr.cpp index aa0237781993..1536349cb0c3 100644 --- a/cfgmgr/vlanmgr.cpp +++ b/cfgmgr/vlanmgr.cpp @@ -330,10 +330,10 @@ void VlanMgr::doVlanTask(Consumer &consumer) */ if (isVlanStateOk(key) && m_vlans.find(key) == m_vlans.end()) { + SWSS_LOG_DEBUG("%s already created", kfvKey(t).c_str()); m_vlans.insert(key); m_vlanReplay.erase(kfvKey(t)); it = consumer.m_toSync.erase(it); - SWSS_LOG_DEBUG("%s already created", kfvKey(t).c_str()); continue; }