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

* #100016: cleanup crypto contexts in audio_srtp_session

parent 42b52b0c
No related branches found
No related tags found
No related merge requests found
......@@ -50,9 +50,11 @@ AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(NULL),
AudioRtpFactory::~AudioRtpFactory()
{
AudioSrtpSession* srtpSession = dynamic_cast<AudioSrtpSession*>(rtpSession_);
if (srtpSession)
srtpSession->deleteCryptoContexts();
delete rtpSession_;
delete cachedLocalContext_;
delete cachedRemoteContext_;
}
void AudioRtpFactory::initConfig()
......
......@@ -306,12 +306,23 @@ void AudioSrtpSession::initializeLocalCryptoContext()
void AudioSrtpSession::restoreCryptoContext(ost::CryptoContext *localContext,
ost::CryptoContext *remoteContext)
{
delete remoteCryptoCtx_;
remoteCryptoCtx_ = remoteContext;
delete localCryptoCtx_;
localCryptoCtx_ = localContext;
if (remoteCryptoCtx_ != remoteContext) {
delete remoteCryptoCtx_;
remoteCryptoCtx_ = remoteContext;
}
if (localCryptoCtx_ != localContext) {
delete localCryptoCtx_;
localCryptoCtx_ = localContext;
}
setInQueueCryptoContext(remoteCryptoCtx_);
setOutQueueCryptoContext(localCryptoCtx_);
}
void AudioSrtpSession::deleteCryptoContexts()
{
delete remoteCryptoCtx_;
remoteCryptoCtx_ = 0;
delete localCryptoCtx_;
localCryptoCtx_ = 0;
}
}
......@@ -101,6 +101,10 @@ class AudioSrtpSession : public AudioSymmetricRtpSession {
*/
void restoreCryptoContext(ost::CryptoContext *, ost::CryptoContext *);
/**
* Force deletion of the current crypto contexts.
*/
void deleteCryptoContexts();
private:
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