activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r740972 - in /activemq/activemq-cpp/trunk/src/main/activemq/transport: IOTransport.cpp IOTransport.h
Date Thu, 05 Feb 2009 01:41:53 GMT
Author: tabish
Date: Thu Feb  5 01:41:52 2009
New Revision: 740972

URL: http://svn.apache.org/viewvc?rev=740972&view=rev
Log:
Fix some memory leaks

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp?rev=740972&r1=740971&r2=740972&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp Thu Feb  5 01:41:52
2009
@@ -42,7 +42,6 @@
     this->outputStream = NULL;
     this->closed = false;
     this->thread = NULL;
-    this->wireFormat = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -53,7 +52,7 @@
     this->outputStream = NULL;
     this->closed = false;
     this->thread = NULL;
-    this->wireFormat = wireFormat;
+    this->wireFormat.reset( wireFormat );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -158,7 +157,7 @@
         }
 
         // Make sure all variables that we need have been set.
-        if( inputStream == NULL || outputStream == NULL || wireFormat == NULL ){
+        if( inputStream == NULL || outputStream == NULL || wireFormat.get() == NULL ){
             throw ActiveMQException(
                 __FILE__, __LINE__,
                 "IOTransport::start() - "
@@ -210,7 +209,7 @@
         }
 
         // Clear the WireFormat so we can't use it anymore
-        this->wireFormat = NULL;
+        this->wireFormat.reset( NULL );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h?rev=740972&r1=740971&r2=740972&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h Thu Feb  5 01:41:52
2009
@@ -29,6 +29,7 @@
 #include <decaf/io/DataInputStream.h>
 #include <decaf/io/DataOutputStream.h>
 #include <decaf/util/logging/LoggerDefines.h>
+#include <memory>
 
 namespace activemq{
 namespace wireformat{
@@ -58,7 +59,7 @@
         /**
          * WireFormat instance to use to Encode / Decode.
          */
-        wireformat::WireFormat* wireFormat;
+        std::auto_ptr<wireformat::WireFormat> wireFormat;
 
         /**
          * Listener of this transport.
@@ -151,7 +152,7 @@
          * @param WireFormat the object used to encode / decode commands.
          */
         virtual void setWireFormat( wireformat::WireFormat* wireFormat ){
-            this->wireFormat = wireFormat;
+            this->wireFormat.reset( wireFormat );
         }
 
         /**



Mime
View raw message