Skip to content
Snippets Groups Projects
Commit 5bfe2bac authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* 100016: don't double free crypto contexts, and don't improperly copy CryptoSuiteDefinitions

parent 1ebbd65d
No related branches found
No related tags found
No related merge requests found
...@@ -50,10 +50,6 @@ AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(NULL), ...@@ -50,10 +50,6 @@ AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(NULL),
AudioRtpFactory::~AudioRtpFactory() AudioRtpFactory::~AudioRtpFactory()
{ {
AudioSrtpSession* srtpSession = dynamic_cast<AudioSrtpSession*>(rtpSession_);
if (srtpSession)
srtpSession->deleteCryptoContexts();
delete rtpSession_; delete rtpSession_;
} }
......
...@@ -262,7 +262,7 @@ void AudioSrtpSession::initializeRemoteCryptoContext() ...@@ -262,7 +262,7 @@ void AudioSrtpSession::initializeRemoteCryptoContext()
{ {
DEBUG("AudioSrtp: Initialize remote crypto context"); DEBUG("AudioSrtp: Initialize remote crypto context");
CryptoSuiteDefinition crypto = sfl::CryptoSuites[remoteCryptoSuite_]; const CryptoSuiteDefinition &crypto = sfl::CryptoSuites[remoteCryptoSuite_];
delete remoteCryptoCtx_; delete remoteCryptoCtx_;
remoteCryptoCtx_ = new ost::CryptoContext(0x0, remoteCryptoCtx_ = new ost::CryptoContext(0x0,
...@@ -285,7 +285,7 @@ void AudioSrtpSession::initializeLocalCryptoContext() ...@@ -285,7 +285,7 @@ void AudioSrtpSession::initializeLocalCryptoContext()
{ {
DEBUG("AudioSrtp: Initialize local crypto context"); DEBUG("AudioSrtp: Initialize local crypto context");
CryptoSuiteDefinition crypto = sfl::CryptoSuites[localCryptoSuite_]; const CryptoSuiteDefinition &crypto = sfl::CryptoSuites[localCryptoSuite_];
delete localCryptoCtx_; delete localCryptoCtx_;
localCryptoCtx_ = new ost::CryptoContext(OutgoingDataQueue::getLocalSSRC(), localCryptoCtx_ = new ost::CryptoContext(OutgoingDataQueue::getLocalSSRC(),
...@@ -318,11 +318,4 @@ void AudioSrtpSession::restoreCryptoContext(ost::CryptoContext *localContext, ...@@ -318,11 +318,4 @@ void AudioSrtpSession::restoreCryptoContext(ost::CryptoContext *localContext,
setOutQueueCryptoContext(localCryptoCtx_); setOutQueueCryptoContext(localCryptoCtx_);
} }
void AudioSrtpSession::deleteCryptoContexts()
{
delete remoteCryptoCtx_;
remoteCryptoCtx_ = 0;
delete localCryptoCtx_;
localCryptoCtx_ = 0;
}
} }
...@@ -101,10 +101,6 @@ class AudioSrtpSession : public AudioSymmetricRtpSession { ...@@ -101,10 +101,6 @@ class AudioSrtpSession : public AudioSymmetricRtpSession {
*/ */
void restoreCryptoContext(ost::CryptoContext *, ost::CryptoContext *); void restoreCryptoContext(ost::CryptoContext *, ost::CryptoContext *);
/**
* Force deletion of the current crypto contexts.
*/
void deleteCryptoContexts();
private: private:
NON_COPYABLE(AudioSrtpSession); NON_COPYABLE(AudioSrtpSession);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment