[reSIProcate] Strange heap corruption message

Matthias Moetje - TERASENS GmbH moetje at terasens.com
Thu Jun 8 07:27:01 CDT 2006


Just in case anyone is interested, I found the solution now.
Reason was that I mixed runtime libraries (debug and non-debug)
because some components were compiled for debug and
some for release. 
The strdup function in ares is uses to fill the channel->lookups
parameter while 'free' is used to destroy it. One of these
functions was used from the debug library (strdup is using 
malloc internally) and the other one from the non-debug
runtime library, thus it was created on one heap and
freed on a different heap (each runtime library uses its
own heap). This had caused the heap corruption error...
 
Best regards,

Matthias Moetje

 	
TERASENS GmbH
Augustenstraße 24
80333 Munich
GERMANY	  	 Phone:
Fax:
e-mail:
Web:	 	+49.89.143370-0
+49.89.143370-22
info at terasens.com <mailto:info at terasens.com> 
www.terasens.com <http://www.terasens.com/> 	
 


________________________________

	From: resiprocate-devel-bounces at list.sipfoundry.org [mailto:resiprocate-devel-bounces at list.sipfoundry.org] On Behalf Of Matthias Moetje - TERASENS GmbH
	Sent: Friday, May 26, 2006 4:22 PM
	To: resiprocate-devel at list.sipfoundry.org
	Subject: [reSIProcate] Strange heap corruption message
	
	
	Hi,
	 
	I am experiencing some strange heap corruption message cause be the following line executed from the destructor of ares:
	free(channel->lookups);

	(ErrorMsg is: HEAP[svchost.exe]: Invalid Address specified to RtlValidateHeap( e80000, e92bf8 ))
	 
	I am not sure if this is the true reason for the error, maybe if has rather to do something how I create and destroy the stack.
	 
	Creation:
	 
	 mStack = new resip::SipStack();
	 mDum = new resip::DialogUsageManager(*mStack);
	 mStackThread = new resip::StackThread(*mStack);
	 mDumThread = new resip::DumThread(*mDum); 
	 
	Destruction:
	 
	  if (mStackThread) 
	  {
	   mStackThread->shutdown();
	  }
	

	  if (mDumThread) 
	  {
	   mDumThread->shutdown();
	  }

	  if (mStackThread) 
	  {
	   mStackThread->join();
	   delete mStackThread;
	   mStackThread = NULL;
	  }

	  if (mDumThread) 
	  {
	   mDumThread->join();
	   delete mDumThread;
	   mDumThread = NULL;
	  }

	  if (mDum) 
	  {
	   delete mDum;
	   mDum = NULL;
	  }
	 
	  if (mStack) 
	  {
	   delete mStack;
	   mStack = NULL;
	  }
	
	Do you see any problems with this code or should I look elswhere for the problem with the heap corruption..?
	 
	Thanks and best regards,

	Matthias Moetje

 	
TERASENS GmbH
Augustenstraße 24
80333 Munich
GERMANY	  	 Phone:
Fax:
e-mail:
Web:	 	+49.89.143370-0
+49.89.143370-22
info at terasens.com <mailto:info at terasens.com> 
www.terasens.com <http://www.terasens.com/> 	
	 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060608/516c28f8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TERASE1.jpg
Type: image/jpeg
Size: 2937 bytes
Desc: TERASE1.jpg
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060608/516c28f8/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attd4e95.jpg
Type: image/jpeg
Size: 2937 bytes
Desc: attd4e95.jpg
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060608/516c28f8/attachment-0001.jpg>


More information about the resiprocate-devel mailing list