axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <samisa_abeysin...@yahoo.com>
Subject Memory leaks - patches
Date Wed, 14 Apr 2004 04:54:31 GMT
Hi All,
    Following are fixes for some of the memory leaks that I found when debugging Axis C++
clients.
	I think they are serious and need to be fixed as soon as possible.
	I tested the samples after the fixes and they work fine (which suggests that the fixes do
not
have any side effects) 
	The files to be updated are... 
	SharedObject.cpp 
	WSDDDeployment.cpp 
	SoapParserXerces.cpp
	SoapDeSerializer.cpp
	SoapSerializer.cpp
Thanks,
Samisa...	
---------------------------------------------	

diff -u ../../original/ws-axis/c/src/engine/SharedObject.cpp ./src/engine/SharedObject.cpp
--- ../../original/ws-axis/c/src/engine/SharedObject.cpp        2004-04-09 11:05:37.000000000
+0600
+++ ./src/engine/SharedObject.cpp       2004-04-12 16:08:29.000000000 +0600
@@ -36,6 +36,7 @@
 #ifdef WIN32
 #else //Linux
     pthread_mutex_destroy (mut);
+    delete mut;
 #endif
 }

---------------------------------------------

diff -u ../../original/ws-axis/c/src/wsdd/WSDDDeployment.cpp ./src/wsdd/WSDDDeployment.cpp
--- ../../original/ws-axis/c/src/wsdd/WSDDDeployment.cpp        2004-04-08 19:30:08.000000000
+0600
+++ ./src/wsdd/WSDDDeployment.cpp       2004-04-12 16:13:26.000000000 +0600
@@ -84,6 +84,7 @@
             delete ((*iter2).second);
         }
     }
+    delete m_pLibNameIdMap;
 }

 const WSDDHandlerList* WSDDDeployment::GetGlobalRequestFlowHandlers()

---------------------------------------------

diff -u ../../original/ws-axis/c/src/soap/SoapParserXerces.cpp ./src/soap/SoapParserXerces.cpp
--- ../../original/ws-axis/c/src/soap/SoapParserXerces.cpp      2004-04-09 18:43:39.000000000
+0600
+++ ./src/soap/SoapParserXerces.cpp     2004-04-13 11:38:00.000000000 +0600
@@ -31,17 +31,24 @@
     m_nStatus = NULL;
     firstParsed = false;
     m_pParser = XMLReaderFactory::createXMLReader();
+    is = NULL;

 }

 SoapParserXerces::~SoapParserXerces()
 {
     m_nStatus = NULL;
+    if(is)
+        delete is;
+    delete m_pParser;
 }

 int SoapParserXerces::SetInputStream(const Ax_soapstream* pInputStream)
 {
     m_pInputStream = pInputStream;
+    //check if memeory is already allocated for is
+    if(is)
+        delete is;
     is = new SoapInputSource(m_pInputStream->transport.pGetFunct,
         m_pInputStream);
     /* SoapInputSource is(m_pInputStream->transport.pGetFunct,

---------------------------------------------

diff -u ../../original/ws-axis/c/src/soap/SoapDeSerializer.cpp ./src/soap/SoapDeSerializer.cpp
--- ../../original/ws-axis/c/src/soap/SoapDeSerializer.cpp      2004-04-09 18:43:39.000000000
+0600
+++ ./src/soap/SoapDeSerializer.cpp     2004-04-14 10:51:03.000000000 +0600
@@ -69,6 +69,10 @@
 SoapDeSerializer::~SoapDeSerializer()
 {
     m_pParser->Init();
+    if (m_pEnv)
+        delete m_pEnv;
+    if(m_pHeader)
+        delete m_pHeader;
     if (m_pParser) delete m_pParser;
 }

@@ -155,6 +159,8 @@
         (0 == strcmp(m_pNode->m_pchNameOrValue,
         SoapKeywordMapping::Map(m_nSoapVersion).pchWords[SKW_HEADER])))
     {
+        if(m_pHeader)
+            delete m_pHeader;
         m_pHeader = new SoapHeader();
         /* Set any attributes/namspaces to the SoapHeader object */

@@ -328,7 +334,10 @@
 {
     if (VERSION_LAST == m_nSoapVersion)
     {
-        GetEnvelope();
+
+        if (m_pEnv)
+               delete m_pEnv;
+        m_pEnv = GetEnvelope();
     }
     return m_nSoapVersion;
 }

---------------------------------------------

diff -u ../../original/ws-axis/c/src/soap/SoapSerializer.cpp ./src/soap/SoapSerializer.cpp
--- ../../original/ws-axis/c/src/soap/SoapSerializer.cpp        2004-04-08 18:24:45.000000000
+0600
+++ ./src/soap/SoapSerializer.cpp       2004-04-12 17:05:15.000000000 +0600
@@ -62,6 +62,12 @@
 SoapSerializer::~SoapSerializer()
 {
     if (m_pSoapEnvelope) delete m_pSoapEnvelope;
+
+    for (int x=0; x<m_nMaxBuffersToCreate; x++)
+    {
+        delete [] m_pSZBuffers[x].buffer;
+    }
+    delete [] m_pSZBuffers;
 }

 int SoapSerializer::setSoapEnvelope(SoapEnvelope *pSoapEnvelope)



	
		
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

Mime
View raw message