remove delete calls (#906)

This commit is contained in:
Marcin K Szczodrak
2016-11-08 07:54:29 -08:00
committed by Jonathan Hui
parent 266232e2a4
commit 8d55f4f823
6 changed files with 16 additions and 29 deletions
-3
View File
@@ -39,7 +39,4 @@
inline void *operator new(size_t, void *p) throw() { return p; }
void OT_CDECL operator delete(void *, size_t) throw();
void OT_CDECL operator delete(void *) throw();
#endif // NEW_HPP_
+2
View File
@@ -107,6 +107,8 @@ ThreadError Commissioner::Stop(void)
mTimer.Stop();
mNetif.GetDtls().Stop();
SendKeepAlive();
exit:
+9 -14
View File
@@ -57,14 +57,6 @@ Dtls::Dtls(ThreadNetif &aNetif):
mProvisioningUrl.Init();
}
Dtls::~Dtls(void)
{
if (mStarted)
{
Close();
}
}
ThreadError Dtls::Start(bool aClient, ReceiveHandler aReceiveHandler, SendHandler aSendHandler, void *aContext)
{
static const int ciphersuites[2] = {0xC0FF, 0}; // EC-JPAKE cipher suite
@@ -136,12 +128,15 @@ ThreadError Dtls::Stop(void)
void Dtls::Close(void)
{
mStarted = false;
mbedtls_ssl_free(&mSsl);
mbedtls_ssl_config_free(&mConf);
mbedtls_ctr_drbg_free(&mCtrDrbg);
mbedtls_entropy_free(&mEntropy);
mbedtls_ssl_cookie_free(&mCookieCtx);
if (mStarted)
{
mStarted = false;
mbedtls_ssl_free(&mSsl);
mbedtls_ssl_config_free(&mConf);
mbedtls_ctr_drbg_free(&mCtrDrbg);
mbedtls_entropy_free(&mEntropy);
mbedtls_ssl_cookie_free(&mCookieCtx);
}
}
bool Dtls::IsStarted(void)
-6
View File
@@ -69,12 +69,6 @@ public:
*/
Dtls(ThreadNetif &aNetif);
/**
* This destructor cleans up the DTLS object.
*
*/
~Dtls(void);
/**
* This function pointer is called when data is received from the DTLS session.
*
-6
View File
@@ -66,9 +66,6 @@ static otDEFINE_ALIGNED_VAR(sInstanceRaw, sizeof(otInstance), uint64_t);
otInstance *sInstance = NULL;
#endif
void OT_CDECL operator delete(void *, size_t) throw() { }
void OT_CDECL operator delete(void *) throw() { }
otInstance::otInstance(void) :
mReceiveIp6DatagramCallback(NULL),
mReceiveIp6DatagramCallbackContext(NULL),
@@ -1159,9 +1156,6 @@ void otInstanceFinalize(otInstance *aInstance)
(void)otThreadStop(aInstance);
(void)otInterfaceDown(aInstance);
// Free the otInstance structure
delete aInstance;
#ifndef OPENTHREAD_MULTIPLE_INSTANCE
sInstance = NULL;
#endif
+5
View File
@@ -115,6 +115,11 @@ ThreadError ThreadNetif::Down(void)
mMeshForwarder.Stop();
mIp6.RemoveNetif(*this);
mIsUp = false;
#if OPENTHREAD_ENABLE_DTLS
mDtls.Stop();
#endif
return kThreadError_None;
}