[reSIProcate] TimerQueue memory leak.
Hi developer's team,
I have written recently about memory leak in TimerQueue, and now I would
like to provide use case.
If someone calls SipStack::postMS( SipStack.cxx:667 ), this causes
Message::clone
SipStack::postMS(const ApplicationMessage& message, unsigned int ms,
TransactionUser* tu)
{
assert(!mShuttingDown);
/////////////////////////////////////////////
Message* toPost = message.clone();
///////////////////////////////////////////////////////////
if (tu) toPost->setTransactionUser(tu);
Lock lock(mAppTimerMutex);
mAppTimers.add(ms,toPost);
//.dcm. timer update rather than process cycle...optimize by
checking if sooner
//than current timeTillNextProcess?
checkAsyncProcessHandler();
}
After that cloned toPost message is added into SipStack::mAppTimers.
toPost is a raw pointer.
TuSelectorTimerQueue::add member function just pushes raw pointer into
TimerQueue::mTimers.
When we stop application TimerQueue pops it's content from mTimers in
it's destructor. In case of raw pointers we get memory leak.
Sincerely,
Taras