activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmitt...@apache.org
Subject svn commit: r506682 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire: OpenWireCommandReader.h OpenWireCommandWriter.h
Date Mon, 12 Feb 2007 21:52:37 GMT
Author: nmittler
Date: Mon Feb 12 13:52:36 2007
New Revision: 506682

URL: http://svn.apache.org/viewvc?view=rev&rev=506682
Log:
[AMQCPP-30] Fixed memory leak in OpenWireCommandReader/Writer

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandReader.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandWriter.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandReader.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandReader.h?view=diff&rev=506682&r1=506681&r2=506682
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandReader.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandReader.h
Mon Feb 12 13:52:36 2007
@@ -64,7 +64,7 @@
         OpenWireCommandReader( io::InputStream* inputStream,
                                OpenWireFormat* openWireFormat );
 
-        virtual ~OpenWireCommandReader() {}
+        virtual ~OpenWireCommandReader();
 
         /**
          * Reads a command from the given input stream.
@@ -80,7 +80,11 @@
          */
         virtual void setInputStream( io::InputStream* inputStream ){
             this->inputStream = inputStream;
-            delete dataInputStream;
+            
+            if( dataInputStream != NULL ) {
+                delete dataInputStream;
+            }
+            
             dataInputStream = new io::DataInputStream( inputStream );
         }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandWriter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandWriter.h?view=diff&rev=506682&r1=506681&r2=506682
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandWriter.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireCommandWriter.h
Mon Feb 12 13:52:36 2007
@@ -62,7 +62,7 @@
         OpenWireCommandWriter( io::OutputStream* outputStream,
                                OpenWireFormat* openWireFormat );
 
-        virtual ~OpenWireCommandWriter(void) {}
+        virtual ~OpenWireCommandWriter();
 
         /**
          * Sets the target output stream.
@@ -70,14 +70,18 @@
          */
         virtual void setOutputStream( io::OutputStream* outputStream ){
             this->outputStream = outputStream;
-            delete dataOutputStream;
+            
+            if( dataOutputStream != NULL ) {
+                delete dataOutputStream;
+            }
+            
             dataOutputStream = new io::DataOutputStream( outputStream );
         }
 
         /**
          * Gets the target output stream.
          */
-        virtual io::OutputStream* getOutputStream(void){
+        virtual io::OutputStream* getOutputStream(){
             return outputStream;
         }
 
@@ -93,7 +97,7 @@
          * Gets the target input stream.
          * @return Target Input Stream
          */
-        virtual OpenWireFormat* getOpenWireFormat(void){
+        virtual OpenWireFormat* getOpenWireFormat(){
             return this->openWireFormat;
         }
 



Mime
View raw message