You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2004/12/22 09:17:03 UTC
cvs commit: ws-axis/c/src/engine/client Call.cpp
samisa 2004/12/22 00:17:03
Modified: c/src/engine/client Call.cpp
Log:
Fixed few trivial memory leak problems in the handling of m_pchSessionID in the method axiscpp::Call::unInitialize().
Revision Changes Path
1.80 +16 -2 ws-axis/c/src/engine/client/Call.cpp
Index: Call.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- Call.cpp 30 Nov 2004 11:49:03 -0000 1.79
+++ Call.cpp 22 Dec 2004 08:17:03 -0000 1.80
@@ -246,8 +246,22 @@
MessageData *msgData = m_pAxisEngine->getMessageData();
AxisChar * pachTemp = (AxisChar *)msgData->getProperty("sessionid");
int len = strlen(pachTemp);
- m_pchSessionID = new char[len];
- strcpy(m_pchSessionID, pachTemp);
+ if ( len > 0 ) // Samisa: check if there is a session key
+ {
+ if (m_pchSessionID) // Samisa: deallocate before allocation
+ {
+ delete [] m_pchSessionID;
+ m_pchSessionID = NULL;
+ }
+ m_pchSessionID = new char[len + 1]; // Samisa: should have space for terminating car
+ strcpy(m_pchSessionID, pachTemp);
+ }
+ else //Samisa: there is no session key
+ {
+ if (m_pchSessionID)
+ delete [] m_pchSessionID;
+ m_pchSessionID = NULL;
+ }
m_pAxisEngine->unInitialize ();
delete m_pAxisEngine;
m_pAxisEngine = NULL;