From 0784502f6532fccf6ff214a45073930a1e0450c7 Mon Sep 17 00:00:00 2001 From: Akhilesh Samineni <47657796+AkhileshSamineni@users.noreply.github.com> Date: Thu, 18 Jun 2020 02:59:59 +0530 Subject: [PATCH] Fixes for NAT lgtm alerts (#1320) --- cfgmgr/natmgr.cpp | 2 +- natsyncd/natsync.cpp | 8 ++++++++ natsyncd/natsync.h | 1 + tests/test_nat.py | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cfgmgr/natmgr.cpp b/cfgmgr/natmgr.cpp index c43d5052075a..4c78d20e8e1b 100644 --- a/cfgmgr/natmgr.cpp +++ b/cfgmgr/natmgr.cpp @@ -3936,7 +3936,7 @@ void NatMgr::setDynamicAllForwardOrAclbasedRules(const string &opCmd, const stri /* After deletion, set acl_interface to None */ if (opCmd == DELETE) { - m_natBindingInfo[dynamicKey].acl_interface == NONE_STRING; + m_natBindingInfo[dynamicKey].acl_interface = NONE_STRING; } } diff --git a/natsyncd/natsync.cpp b/natsyncd/natsync.cpp index 1db37c5c2626..c8fe3a804163 100644 --- a/natsyncd/natsync.cpp +++ b/natsyncd/natsync.cpp @@ -61,6 +61,14 @@ NatSync::NatSync(RedisPipeline *pipelineAppDB, DBConnector *appDb, DBConnector * } } +NatSync::~NatSync() +{ + if (m_AppRestartAssist) + { + delete m_AppRestartAssist; + } +} + /* To check the port init is done or not */ bool NatSync::isPortInitDone(DBConnector *app_db) { diff --git a/natsyncd/natsync.h b/natsyncd/natsync.h index e4ea8c6f1823..27e4cb9c0d9d 100644 --- a/natsyncd/natsync.h +++ b/natsyncd/natsync.h @@ -43,6 +43,7 @@ class NatSync : public NetMsg { public: NatSync(RedisPipeline *pipelineAppDB, DBConnector *appDb, DBConnector *stateDb, NfNetlink *nfnl); + ~NatSync(); virtual void onMsg(int nlmsg_type, struct nl_object *obj); diff --git a/tests/test_nat.py b/tests/test_nat.py index 0f60a2aa0054..6b89e44e0456 100644 --- a/tests/test_nat.py +++ b/tests/test_nat.py @@ -114,7 +114,7 @@ def test_DelNatStaticEntry(self, dvs, testlog): self.app_db.wait_for_n_keys("NAT_TABLE", 0) #check the entry is not there in asic db - keys = self.asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_NAT_ENTRY", 0) + self.asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_NAT_ENTRY", 0) def test_AddNaPtStaticEntry(self, dvs, testlog): # initialize