Skip to content
Snippets Groups Projects
Commit 0992f941 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#4243] Fix memory leak in AudioSrtpSession

parent ea02875a
No related branches found
No related tags found
No related merge requests found
......@@ -58,10 +58,25 @@ AudioSrtpSession::AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall) :
_localMasterSaltLength (0),
_remoteMasterKeyLength (0),
_remoteMasterSaltLength (0),
_remoteCryptoCtx (NULL),
_localCryptoCtx (NULL),
_remoteOfferIsSet (false)
{
}
AudioSrtpSession::~AudioSrtpSession()
{
if (_remoteCryptoCtx) {
delete _remoteCryptoCtx;
_remoteCryptoCtx = NULL;
}
if (_localCryptoCtx) {
delete _localCryptoCtx;
_localCryptoCtx = NULL;
}
}
void AudioSrtpSession::initLocalCryptoInfo()
{
_debug ("AudioSrtp: Set cryptographic info for this rtp session");
......@@ -241,6 +256,11 @@ void AudioSrtpSession::initializeRemoteCryptoContext (void)
CryptoSuiteDefinition crypto = sfl::CryptoSuites[_remoteCryptoSuite];
if (_remoteCryptoCtx) {
delete _remoteCryptoCtx;
_remoteCryptoCtx = NULL;
}
_remoteCryptoCtx = new ost::CryptoContext (0x0,
0, // roc,
0L, // keydr,
......@@ -263,6 +283,11 @@ void AudioSrtpSession::initializeLocalCryptoContext (void)
CryptoSuiteDefinition crypto = sfl::CryptoSuites[_localCryptoSuite];
if (_localCryptoCtx) {
delete _localCryptoCtx;
_localCryptoCtx = NULL;
}
_localCryptoCtx = new ost::CryptoContext (OutgoingDataQueue::getLocalSSRC(),
0, // roc,
0L, // keydr,
......
......@@ -83,6 +83,8 @@ class AudioSrtpSession : public ost::SymmetricRTPSession, public AudioRtpSession
*/
AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall);
~AudioSrtpSession();
/**
* Used to get sdp crypto header to be included in sdp session. This
* method must be called befor setRemoteCryptoInfo in case of an
......
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