< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate] Memory leak in reTurn

Hi Diego,

Nice find.  That looks correct to me.  I will commit a fix to GIT, thanks!


On Wed, Apr 17, 2019 at 1:04 PM Diego Carvalho Domingos <ddomingos@xxxxxxxxxx> wrote:

Hi all,

It seems there is a memory leak in TurnSocket.cxx, in this section:

         // Stun Message has first two bits as 00

         if((mReadBuffer[0] & 0xC0) == 0)


            // StunMessage

            StunMessage* stunMsg = new StunMessage(mLocalBinding, mConnectedTuple, &mReadBuffer[0], readSize);

            unsigned int tempsize = size;

            errorCode = handleStunMessage(*stunMsg, buffer, tempsize, sourceAddress, sourcePort);

            if(!errorCode && tempsize == 0)  // Signifies that a Stun/Turn request was received and there is nothing to return to receive caller


               done = false;




              size = tempsize;




I don’t see where stunMsg is deleted. I think it can be safely deleted before leaving the if block because it will be processed in handleStunMessage. Is this correct?

Best regards,



resiprocate-devel mailing list