Bug 14 - Memory leak on UdpTransport & ConnectionBase
Summary: Memory leak on UdpTransport & ConnectionBase
Status: NEW
Alias: None
Product: resiprocate
Classification: Unclassified
Component: stack (libresip) (show other bugs)
Version: 1.2
Hardware: All All
: P1 normal
Assignee: Owner of all unassigned bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-06 05:01 CDT by Park, SeongWoo
Modified: 2009-04-29 12:34 CDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Park, SeongWoo 2008-09-06 05:01:07 CDT
libresip has memory leak in UdpTransport & ConnectionBased

in UdpTransport.cxx

SipMessage* message = new SipMessage(this);

.
. exception.
.

mStateMachineFifo.add(message);

When we test malformed SIP message testing,

UdpTransport does not handle ParseException.

Please fix the bug on next release like below.

void 
UdpTransport::process(FdSet& fdset)
{
.
.
.
.
.
.
line 320:
	SipMessage* message = new SipMessage(this);
	try
	{
	.
	. exception.
	.
	mStateMachineFifo.add(message);
	}
	catch( ParseException& e )
	{
		delete message;
		throw e;
	}


in ConnectionBase.cxx is same;


void
ConnectionBase::preparseNewBytes(int bytesRead, Fifo<TransactionMessage>& fifo)
{
	assert(mWho.transport);

	DebugLog(<< "In State: " << connectionStates[mConnState]);
	//getConnectionManager().touch(this); -- !dcm!

start:   // If there is an overhang come back here, effectively recursing

	try
	{
		switch(mConnState)
		{
		
		.
		. exception
		.
		.
		}
	}
	catch( ParseException& e )
	{
		if( mMessage )
		{
			delete mMessage;
			mMessage=NULL;
		}
		throw e;
	}
Comment 1 Byron Campen 2009-04-28 16:30:40 CDT
I guess we must be getting a ParseException thrown inside SipMessage::setStartLine(). I think I am going to rewrite this function; I see lots of bugs in it.
Comment 2 Byron Campen 2009-04-29 12:34:54 CDT
I have removed the code that can throw a ParseException from SipMessage::setStartLine(); can you try your test on the latest code from head?