X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=016d88c8e517933129ad120fe19c8661a28c83f7;hb=c9d154855efd508e1a4225841616504087f88e6e;hp=3bfa061548c0e4b74d4811e7296790a6849b2630;hpb=04be3a97ee3b6779909af7d2655f09ec10930a23;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 3bfa061..016d88c 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -43,6 +43,7 @@ #include "LibCEC.h" #include "CECClient.h" #include "platform/util/timeutils.h" +#include "platform/util/util.h" using namespace CEC; using namespace std; @@ -66,7 +67,7 @@ CCECProcessor::CCECProcessor(CLibCEC *libcec) : CCECProcessor::~CCECProcessor(void) { Close(); - delete m_busDevices; + DELETE_AND_NULL(m_busDevices); } bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = CEC_SERIAL_DEFAULT_BAUDRATE */, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */) @@ -98,21 +99,13 @@ void CCECProcessor::Close(void) StopThread(); // close the connection - if (m_communication) - { - delete m_communication; - m_communication = NULL; - } + DELETE_AND_NULL(m_communication); } void CCECProcessor::ResetMembers(void) { // close the connection - if (m_communication) - { - delete m_communication; - m_communication = NULL; - } + DELETE_AND_NULL(m_communication); // reset the other members to the initial state m_iStandardLineTimeout = 3; @@ -517,7 +510,7 @@ bool CCECProcessor::StartBootloader(const char *strPort /* = NULL */) if (comm->IsOpen()) { bReturn = comm->StartBootloader(); - delete comm; + DELETE_AND_NULL(comm); } return bReturn; }