From 17a2f93a545b8669e44a62231c340ba518272ed7 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 18 Jun 2020 23:40:27 -0700 Subject: [PATCH] Fix array delete and header guard (#1327) --- fpmsyncd/fpmlink.cpp | 2 +- mclagsyncd/mclaglink.cpp | 4 ++-- orchagent/notifications.h | 2 ++ orchagent/notifier.h | 2 ++ tests/mock_tests/mock_table.h | 2 ++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fpmsyncd/fpmlink.cpp b/fpmsyncd/fpmlink.cpp index 464f96522175..28772459f679 100644 --- a/fpmsyncd/fpmlink.cpp +++ b/fpmsyncd/fpmlink.cpp @@ -61,7 +61,7 @@ FpmLink::FpmLink(unsigned short port) : FpmLink::~FpmLink() { - delete m_messageBuffer; + delete[] m_messageBuffer; if (m_connected) close(m_connection_socket); if (m_server_up) diff --git a/mclagsyncd/mclaglink.cpp b/mclagsyncd/mclaglink.cpp index 369dff08f0d4..d5e38fe57806 100644 --- a/mclagsyncd/mclaglink.cpp +++ b/mclagsyncd/mclaglink.cpp @@ -632,8 +632,8 @@ MclagLink::MclagLink(int port) : MclagLink::~MclagLink() { - delete m_messageBuffer; - delete m_messageBuffer_send; + delete[] m_messageBuffer; + delete[] m_messageBuffer_send; if (m_connected) close(m_connection_socket); if (m_server_up) diff --git a/orchagent/notifications.h b/orchagent/notifications.h index 961e2eae9fd8..2ee207ebfaf1 100644 --- a/orchagent/notifications.h +++ b/orchagent/notifications.h @@ -1,3 +1,5 @@ +#pragma once + extern "C" { #include "sai.h" } diff --git a/orchagent/notifier.h b/orchagent/notifier.h index 2df9c7ff6c84..36416ab7f0b7 100644 --- a/orchagent/notifier.h +++ b/orchagent/notifier.h @@ -1,3 +1,5 @@ +#pragma once + #include "orch.h" class Notifier : public Executor { diff --git a/tests/mock_tests/mock_table.h b/tests/mock_tests/mock_table.h index bf8a4bdef610..88aed225ea9f 100644 --- a/tests/mock_tests/mock_table.h +++ b/tests/mock_tests/mock_table.h @@ -1,3 +1,5 @@ +#pragma once + #include "table.h" namespace testing_db