susantha    2003/08/16 05:48:29

  Modified:    c/src/common Debug.cpp Packet.h
               c/src/engine AppScopeHandlerPool.cpp AxisEngine.cpp
                        DeserializerPool.cpp HandlerLoader.cpp
                        HandlerPool.cpp Main.c RequestScopeHandlerPool.cpp
                        SerializerPool.cpp SessionScopeHandlerPool.cpp
               c/src/server/apache mod_axis.c
               c/src/server/samples/webservicewrapper Service.cpp
               c/src/soap SoapDeSerializer.cpp SoapDeSerializer.h
                        SoapSerializer.cpp SoapSerializer.h
               c/src/wsdd WSDDDocument.cpp
  Log:
  fixed memory leaks
  
  Revision  Changes    Path
  1.7       +1 -1      xml-axis/c/src/common/Debug.cpp
  
  Index: Debug.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Debug.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Debug.cpp 16 Aug 2003 08:15:47 -0000      1.6
  +++ Debug.cpp 16 Aug 2003 12:48:28 -0000      1.7
  @@ -21,7 +21,7 @@
   Debug::~Debug()
   {
     fout->close();
  -  fout = NULL;
  +  delete fout;
   }
   
   int Debug::debug(const string &sLog,string arg2, int arg3)
  
  
  
  1.7       +4 -4      xml-axis/c/src/common/Packet.h
  
  Index: Packet.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/Packet.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Packet.h  16 Aug 2003 08:15:47 -0000      1.6
  +++ Packet.h  16 Aug 2003 12:48:28 -0000      1.7
  @@ -7,8 +7,8 @@
   
   typedef struct 
   {
  -     void* ip_stream;
  -     void* op_stream;
  +     const void* ip_stream;
  +     const void* op_stream;
   } Ax_iostream;
   /*
   typedef enum
  @@ -82,11 +82,11 @@
   
        //This function should be implemented by module authors
        //Allows to send pieces of soap response the transport handler
  -     int send_response_bytes(const char* res, void* opstream);
  +     int send_response_bytes(const char* res, const void* opstream);
   
        //This function should be implemented by module authors
        //Allows axis to get pieces of the request as they come to the transport 
listener
  -     int get_request_bytes(char* req, int reqsize, int* retsize, void* ipstream);
  +     int get_request_bytes(char* req, int reqsize, int* retsize, const void* 
ipstream);
   
        //This fucntion should be implemented by module authors
        int send_transport_information(Ax_soapstream *str);
  
  
  
  1.2       +9 -1      xml-axis/c/src/engine/AppScopeHandlerPool.cpp
  
  Index: AppScopeHandlerPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/AppScopeHandlerPool.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AppScopeHandlerPool.cpp   13 Aug 2003 14:07:47 -0000      1.1
  +++ AppScopeHandlerPool.cpp   16 Aug 2003 12:48:28 -0000      1.2
  @@ -19,7 +19,15 @@
   
   AppScopeHandlerPool::~AppScopeHandlerPool()
   {
  -
  +     for (map<int, list<BasicHandler*> >::iterator it = m_Handlers.begin(); it != 
m_Handlers.end(); it++)
  +     {
  +             for (list<BasicHandler*>::iterator itr = (*it).second.begin(); itr != 
(*it).second.end(); itr++)
  +             {
  +                     g_HandlerLoader.DeleteHandler(*itr, (*it).first);
  +             }
  +             (*it).second.clear();
  +     }
  +     m_Handlers.clear();
   }
   
   //this method does not block the object. Instead expects that the calling thread 
  
  
  
  1.16      +1 -7      xml-axis/c/src/engine/AxisEngine.cpp
  
  Index: AxisEngine.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/AxisEngine.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AxisEngine.cpp    14 Aug 2003 14:03:14 -0000      1.15
  +++ AxisEngine.cpp    16 Aug 2003 12:48:28 -0000      1.16
  @@ -71,12 +71,6 @@
   #include "DeserializerPool.h"
   #include "SerializerPool.h"
   
  -//extern int send_response_bytes(char * res);
  -
  -//extern int get_request_bytes(char * req, int reqsize, int* retsize);
  -
  -//extern int send_transport_information(soapstream *);
  -
   extern DeserializerPool g_DeserializerPool;
   extern SerializerPool g_SerializerPool;
   extern HandlerPool g_HandlerPool;
  @@ -243,7 +237,7 @@
                //send any transoport information like http headers first
                send_transport_information(soap);
                //Serialize
  -             m_pSZ->SetOutputStream(soap->str.ip_stream);
  +             m_pSZ->SetOutputStream(soap->str.op_stream);
   
                //Pool back the Service specific handlers
                if (m_pSReqFChain) g_HandlerPool.PoolHandlerChain(m_pSReqFChain, 
sSessionId);
  
  
  
  1.3       +16 -13    xml-axis/c/src/engine/DeserializerPool.cpp
  
  Index: DeserializerPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/DeserializerPool.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DeserializerPool.cpp      14 Aug 2003 14:03:14 -0000      1.2
  +++ DeserializerPool.cpp      16 Aug 2003 12:48:28 -0000      1.3
  @@ -15,7 +15,10 @@
   
   DeserializerPool::~DeserializerPool()
   {
  -
  +     for (list<SoapDeSerializer*>::iterator it = m_DZList.begin(); it != 
m_DZList.end(); it++)
  +     {
  +             delete (*it);
  +     }
   }
   
   int DeserializerPool::GetInstance(SoapDeSerializer** ppDZ)
  @@ -29,18 +32,13 @@
        else
        {
                *ppDZ = new SoapDeSerializer();
  -     }
  -     if (!(*ppDZ))
  -     {
  -             unlock();
  -             return FAIL;            
  -     }
  -     if (SUCCESS != (*ppDZ)->Init())
  -     {
  -             m_DZList.push_back(*ppDZ);
  -             *ppDZ = NULL;
  -             unlock();
  -             return FAIL;
  +             if (SUCCESS != (*ppDZ)->Init())
  +             {
  +                     delete *ppDZ;
  +                     *ppDZ = NULL;
  +                     unlock();
  +                     return FAIL;
  +             }
        }
        unlock();
        return SUCCESS;
  @@ -48,6 +46,11 @@
   
   int DeserializerPool::PutInstance(SoapDeSerializer* pDZ)
   {
  +     if (SUCCESS != pDZ->Init())
  +     {
  +             delete pDZ;
  +             return FAIL;
  +     }
        lock();
        m_DZList.push_back(pDZ);
        unlock();
  
  
  
  1.6       +1 -0      xml-axis/c/src/engine/HandlerLoader.cpp
  
  Index: HandlerLoader.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/HandlerLoader.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HandlerLoader.cpp 16 Aug 2003 08:15:47 -0000      1.5
  +++ HandlerLoader.cpp 16 Aug 2003 12:48:28 -0000      1.6
  @@ -136,6 +136,7 @@
        if (m_HandlerInfoList.find(nLibId) == m_HandlerInfoList.end())
        {
                HandlerInformation* pHandlerInfo = new HandlerInformation();
  +             memset(pHandlerInfo, 0, sizeof(HandlerInformation));
                pHandlerInfo->m_sLib = g_WSDDDeployment.GetLibName(nLibId);
                if (pHandlerInfo->m_sLib.empty())
                {
  
  
  
  1.8       +4 -0      xml-axis/c/src/engine/HandlerPool.cpp
  
  Index: HandlerPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/HandlerPool.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- HandlerPool.cpp   15 Aug 2003 04:31:25 -0000      1.7
  +++ HandlerPool.cpp   16 Aug 2003 12:48:28 -0000      1.8
  @@ -86,6 +86,10 @@
   
   HandlerPool::~HandlerPool()
   {
  +     for (list<HandlerChain*>::iterator it = m_ChainStore.begin(); it != 
m_ChainStore.end(); it++)
  +     {
  +             delete (*it);
  +     }
   }
   
   int HandlerPool::GetHandler(BasicHandler** ppHandler, string& sSessionId, int 
nScope, int nLibId)
  
  
  
  1.9       +8 -6      xml-axis/c/src/engine/Main.c
  
  Index: Main.c
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/Main.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Main.c    16 Aug 2003 08:15:47 -0000      1.8
  +++ Main.c    16 Aug 2003 12:48:28 -0000      1.9
  @@ -188,7 +188,8 @@
        str->trtype = APTHTTP;
        str->sessionid = "somesessionid";
        str->so.http.ip_method = AXIS_HTTP_POST;
  -
  +     str->str.ip_stream = "is";
  +     str->str.op_stream = "os";
        str->so.http.ip_headers = (Ax_header*)malloc(sizeof(Ax_header));
        str->so.http.ip_headers->headername = SOAPACTIONHEADER;
        str->so.http.ip_headers->headervalue = "\"Calculator\"";        
  @@ -197,19 +198,20 @@
        printf("soap request :\n %s\n", ip);
   
        initialize_module();
  -     for (xx =0; xx < 1000 ; xx++)
  +     for (xx =0; xx < 100 ; xx++)
                process_request(str);   
  -
  +     free(str->so.http.ip_headers);
  +     free(str);
        return 0;
   }
   
  -int send_response_bytes(const char * res, void* pOutputStream) 
  +int send_response_bytes(const char * res, const void* opstream) 
   {
  -//   printf("sending SOAP response : \n%s\n", res);
  +     printf("sending SOAP response : \n%s\n", res);
        return 0;
   }
   
  -int get_request_bytes(char * req, int reqsize, int* retsize) 
  +int get_request_bytes(char * req, int reqsize, int* retsize, const void* ipstream) 
   {
        req[0]= '\0';
        strcat(req, ip);
  
  
  
  1.2       +9 -1      xml-axis/c/src/engine/RequestScopeHandlerPool.cpp
  
  Index: RequestScopeHandlerPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/RequestScopeHandlerPool.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestScopeHandlerPool.cpp       13 Aug 2003 14:07:47 -0000      1.1
  +++ RequestScopeHandlerPool.cpp       16 Aug 2003 12:48:28 -0000      1.2
  @@ -17,7 +17,15 @@
   
   RequestScopeHandlerPool::~RequestScopeHandlerPool()
   {
  -
  +     for (map<int, list<BasicHandler*> >::iterator it = m_Handlers.begin(); it != 
m_Handlers.end(); it++)
  +     {
  +             for (list<BasicHandler*>::iterator itr = (*it).second.begin(); itr != 
(*it).second.end(); itr++)
  +             {
  +                     g_HandlerLoader.DeleteHandler(*itr, (*it).first);
  +             }
  +             (*it).second.clear();
  +     }
  +     m_Handlers.clear();
   }
   
   int RequestScopeHandlerPool::GetInstance(BasicHandler** pHandler, int nLibId)
  
  
  
  1.3       +16 -13    xml-axis/c/src/engine/SerializerPool.cpp
  
  Index: SerializerPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/SerializerPool.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SerializerPool.cpp        14 Aug 2003 14:03:14 -0000      1.2
  +++ SerializerPool.cpp        16 Aug 2003 12:48:28 -0000      1.3
  @@ -15,7 +15,10 @@
   
   SerializerPool::~SerializerPool()
   {
  -
  +     for (list<SoapSerializer*>::iterator it = m_SZList.begin(); it != 
m_SZList.end(); it++)
  +     {
  +             delete (*it);
  +     }
   }
   
   //pooling should be implemented
  @@ -30,18 +33,13 @@
        else
        {
                *ppSZ = new SoapSerializer();
  -     }
  -     if (!(*ppSZ))
  -     {
  -             unlock();
  -             return FAIL;            
  -     }
  -     if (SUCCESS != (*ppSZ)->Init())
  -     {
  -             m_SZList.push_back(*ppSZ);
  -             *ppSZ = NULL;
  -             unlock();
  -             return FAIL;
  +             if (SUCCESS != (*ppSZ)->Init())
  +             {
  +                     delete *ppSZ;
  +                     *ppSZ = NULL;
  +                     unlock();
  +                     return FAIL;
  +             }
        }
        unlock();
        return SUCCESS;
  @@ -49,6 +47,11 @@
   
   int SerializerPool::PutInstance(SoapSerializer* pSZ)
   {
  +     if (SUCCESS != pSZ->Init())
  +     {
  +             delete pSZ;
  +             return FAIL;
  +     }
        lock();
        m_SZList.push_back(pSZ);
        unlock();
  
  
  
  1.2       +14 -1     xml-axis/c/src/engine/SessionScopeHandlerPool.cpp
  
  Index: SessionScopeHandlerPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/SessionScopeHandlerPool.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SessionScopeHandlerPool.cpp       13 Aug 2003 14:07:47 -0000      1.1
  +++ SessionScopeHandlerPool.cpp       16 Aug 2003 12:48:28 -0000      1.2
  @@ -18,7 +18,20 @@
   
   SessionScopeHandlerPool::~SessionScopeHandlerPool()
   {
  -
  +     for (map<int, SessionHandlers*>::iterator it = m_Handlers.begin(); it != 
m_Handlers.end(); it++)
  +     {
  +             SessionHandlers* pSH = (*it).second;
  +             for (SessionHandlers::iterator itr = pSH->begin(); itr != pSH->end(); 
itr++)
  +             {
  +                     for (list<BasicHandler*>::iterator ite = 
(*itr).second.begin(); ite != (*itr).second.end(); ite++)
  +                     {
  +                             g_HandlerLoader.DeleteHandler(*ite, (*it).first);
  +                     }
  +                     (*itr).second.clear();
  +             }
  +             delete pSH;
  +     }
  +     m_Handlers.clear();
   }
   
   int SessionScopeHandlerPool::GetInstance(string& sSessionId, BasicHandler** 
pHandler, int nLibId)
  
  
  
  1.6       +2 -2      xml-axis/c/src/server/apache/mod_axis.c
  
  Index: mod_axis.c
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/server/apache/mod_axis.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_axis.c        16 Aug 2003 08:15:47 -0000      1.5
  +++ mod_axis.c        16 Aug 2003 12:48:29 -0000      1.6
  @@ -39,7 +39,7 @@
        initialize_module();
   }
   
  -int send_response_bytes(const char* res, void* opstream)
  +int send_response_bytes(const char* res, const void* opstream)
   {
        ap_rputs(res, (request_rec*)opstream);
        return 0;
  @@ -52,7 +52,7 @@
   void axis_Fini(server_rec *svr_rec, pool* p)
   {}
   
  -int get_request_bytes(char* req, int reqsize, int* retsize, void* ipstream)
  +int get_request_bytes(char* req, int reqsize, int* retsize, const void* ipstream)
   {
        int len_read;
        ap_hard_timeout("util_read", (request_rec*)ipstream);
  
  
  
  1.2       +1 -1      xml-axis/c/src/server/samples/webservicewrapper/Service.cpp
  
  Index: Service.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/server/samples/webservicewrapper/Service.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Service.cpp       25 Jun 2003 04:55:18 -0000      1.1
  +++ Service.cpp       16 Aug 2003 12:48:29 -0000      1.2
  @@ -91,7 +91,7 @@
   {
        if (inst) 
        {
  -             WrapperClassHandler* pWCH = dynamic_cast<WrapperClassHandler*>(inst);
  +             WrapperClassHandler* pWCH = static_cast<WrapperClassHandler*>(inst);
                pWCH->Fini();
                delete pWCH;
                return SUCCESS;
  
  
  
  1.7       +3 -4      xml-axis/c/src/soap/SoapDeSerializer.cpp
  
  Index: SoapDeSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/SoapDeSerializer.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SoapDeSerializer.cpp      14 Aug 2003 14:03:35 -0000      1.6
  +++ SoapDeSerializer.cpp      16 Aug 2003 12:48:29 -0000      1.7
  @@ -92,10 +92,9 @@
        delete m_pParser;
   }
   
  -int SoapDeSerializer::SetInputStream(void* InputStream)
  +int SoapDeSerializer::SetInputStream(const void* InputStream)
   {
        m_pInputStream = InputStream;
  -     MemBufInputSource* pSoapInput = NULL;
        //---------------------start--------------------------
        //Deserialize
        //---------START XERCES SAX2 SPCIFIC CODE---------//
  @@ -107,8 +106,8 @@
        get_request_bytes(m_hugebuffer, HUGE_BUFFER_SIZE, &nChars, m_pInputStream);
        //if no soap then quit
        if (nChars <= 0) return FAIL;
  -     pSoapInput = new MemBufInputSource((const unsigned char*)m_hugebuffer, nChars 
,"bufferid",false);
  -     m_pParser->parse(*pSoapInput);
  +     MemBufInputSource Input((const unsigned char*)m_hugebuffer, nChars , 
"bufferid");
  +     m_pParser->parse(Input);
        return SUCCESS;
   }
   
  
  
  
  1.9       +2 -2      xml-axis/c/src/soap/SoapDeSerializer.h
  
  Index: SoapDeSerializer.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/SoapDeSerializer.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SoapDeSerializer.h        14 Aug 2003 14:03:35 -0000      1.8
  +++ SoapDeSerializer.h        16 Aug 2003 12:48:29 -0000      1.9
  @@ -88,7 +88,7 @@
   private:
        XMLStreamHandler* m_pHandler;
        SAX2XMLReader* m_pParser;
  -     void* m_pInputStream;
  +     const void* m_pInputStream;
        char m_hugebuffer[HUGE_BUFFER_SIZE];
   public:
        int GetVersion();
  @@ -101,7 +101,7 @@
        SoapBody* GetBody();
        ISoapHeader* GetHeader();
        SoapEnvelope* GetEnvelope();
  -     int SetInputStream(void* InputStream);
  +     int SetInputStream(const void* InputStream);
        SoapDeSerializer();
        virtual ~SoapDeSerializer();
   
  
  
  
  1.14      +1 -1      xml-axis/c/src/soap/SoapSerializer.cpp
  
  Index: SoapSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/SoapSerializer.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SoapSerializer.cpp        16 Aug 2003 08:15:47 -0000      1.13
  +++ SoapSerializer.cpp        16 Aug 2003 12:48:29 -0000      1.14
  @@ -178,7 +178,7 @@
        return m_sSerializedStream;
   }*/
   
  -int SoapSerializer::SetOutputStream(void* pStream)
  +int SoapSerializer::SetOutputStream(const void* pStream)
   {
        m_pOutputStream = pStream;
        int iStatus= SUCCESS;
  
  
  
  1.12      +2 -2      xml-axis/c/src/soap/SoapSerializer.h
  
  Index: SoapSerializer.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/SoapSerializer.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SoapSerializer.h  16 Aug 2003 08:15:47 -0000      1.11
  +++ SoapSerializer.h  16 Aug 2003 12:48:29 -0000      1.12
  @@ -103,7 +103,7 @@
        const char* getNewNamespacePrefix();
        int setSoapVersion(SOAP_VERSION);
        int Init();
  -     int SetOutputStream(void* pStream);
  +     int SetOutputStream(const void* pStream);
        int setSoapFault(SoapFault* pSoapFault);
        int setSoapMethod(SoapMethod* pSoapMethod);
        int setSoapBody(SoapBody* pSoapBody);
  @@ -122,7 +122,7 @@
        string& SerializeBasicType(const string& sName, int nValue);
   private:
        BasicTypeSerializer m_BTSZ;
  -     void* m_pOutputStream;
  +     const void* m_pOutputStream;
   };
   
   #endif // 
!defined(AFX_SOAPSERIALIZER_H__C37229AD_BD54_430D_9619_E4574CF95334__INCLUDED_)
  
  
  
  1.7       +3 -2      xml-axis/c/src/wsdd/WSDDDocument.cpp
  
  Index: WSDDDocument.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/wsdd/WSDDDocument.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WSDDDocument.cpp  16 Aug 2003 08:15:47 -0000      1.6
  +++ WSDDDocument.cpp  16 Aug 2003 12:48:29 -0000      1.7
  @@ -99,11 +99,12 @@
        DEBUG1("inside ParseDocument\n");
        try
        {
  -             SAX2XMLReader * parser = XMLReaderFactory::createXMLReader();
  +             SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
                parser->setContentHandler(this);
                parser->setErrorHandler(this);     
                DEBUG1("BEFORE parser->parse(sWSDD.c_str());");
  -             parser->parse(sWSDD.c_str());      
  +             parser->parse(sWSDD.c_str());   
  +             delete parser;
        }
        catch (...)
        {
  
  
  

Reply via email to