axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject cvs commit: ws-axis/c/tests/auto_build/testcases/client/cpp AxisBenchClient.cpp
Date Mon, 17 Jan 2005 02:54:48 GMT
samisa      2005/01/16 18:54:48

  Modified:    c/tests/auto_build/testcases/client/cpp AxisBenchClient.cpp
  Log:
  Added memory clean up code segments. This is important to ensure deallocation of memory.
  
  Revision  Changes    Path
  1.15      +23 -3     ws-axis/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp
  
  Index: AxisBenchClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AxisBenchClient.cpp	13 Jan 2005 08:59:39 -0000	1.14
  +++ AxisBenchClient.cpp	17 Jan 2005 02:54:48 -0000	1.15
  @@ -37,6 +37,10 @@
   { 
     AxisBench *ws;
   
  +  BenchDataType *input = NULL;
  +  BenchDataType *output = NULL;
  +  xsd__unsignedByte* buffer = NULL;
  +
     char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
     int returnValue = 1; // Assume Failure
  @@ -51,9 +55,7 @@
       } else
         ws = new AxisBench();
   
  -    BenchDataType *input;
  -    BenchDataType *output;
  -    xsd__unsignedByte* buffer;
  +    
       int request = 1;
         
       input = new BenchDataType();
  @@ -136,6 +138,12 @@
   #endif
   
       for ( int ii = 0; ii < request ; ii++ ) {
  +        if (output) { // Samisa: memory management BP
  +            for (int i = 0; i < output->infos.m_Size; i++)
  +                delete (BenchBasicDataType*)(output->infos.m_Array[i]);
  +            delete output;
  +            output = NULL;
  +        }
         output = ws->doBenchRequest(input);
       }
   
  @@ -216,6 +224,18 @@
       cerr << "Unknown Exception occured." << endl;
       if(endpoint_set)
         free(endpoint);
  +  }
  +
  +  // Samisa: make sure we clean up memory allocated
  +  delete ws; 
  +  for (int i = 0; i < input->infos.m_Size; i++)
  +      delete (BenchBasicDataType*)(input->infos.m_Array[i]);
  +  delete input;
  +  if (output)
  +  {
  +    for (i = 0; i < output->infos.m_Size; i++)
  +      delete (BenchBasicDataType*)(output->infos.m_Array[i]);
  +    delete output;
     }
     return returnValue;
   
  
  
  

Mime
View raw message