You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2008/02/06 17:32:38 UTC
svn commit: r619056 - in /activemq/activemq-cpp/decaf/trunk/src:
main/decaf/internal/nio/ main/decaf/internal/util/ main/decaf/nio/
test/decaf/internal/nio/ test/decaf/internal/util/ test/decaf/io/
Author: tabish
Date: Wed Feb 6 08:32:35 2008
New Revision: 619056
URL: http://svn.apache.org/viewvc?rev=619056&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-153
Fixing memory leaks introduced with this code.
Modified:
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.h
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayPerspectiveTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataOutputStreamTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/FilterOutputStreamTest.cpp
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp Wed Feb 6 08:32:35 2008
@@ -87,6 +87,25 @@
this->readOnly = other.readOnly;
}
+////////////////////////////////////////////////////////////////////////////////
+CharArrayBuffer::~CharArrayBuffer() {
+
+ try{
+
+ // Return this object's reference to the buffer.
+ this->_array->returnRef();
+
+ // If there are no other Buffers out there that reference it then we
+ // delete it now, the internal unsigned char* array will be deleted
+ // if we where the owner.
+ if( this->_array->getReferences() == 0 ) {
+ delete this->_array;
+ }
+ }
+ DECAF_CATCH_NOTHROW( Exception )
+ DECAF_CATCHALL_NOTHROW()
+}
+
///////////////////////////////////////////////////////////////////////////////
char* CharArrayBuffer::array()
throw( decaf::lang::exceptions::UnsupportedOperationException,
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/CharArrayBuffer.h Wed Feb 6 08:32:35 2008
@@ -91,7 +91,7 @@
*/
CharArrayBuffer( const CharArrayBuffer& other );
- virtual ~CharArrayBuffer() {}
+ virtual ~CharArrayBuffer();
public: // Overrides
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.cpp Wed Feb 6 08:32:35 2008
@@ -88,6 +88,25 @@
this->readOnly = other.readOnly;
}
+////////////////////////////////////////////////////////////////////////////////
+DoubleArrayBuffer::~DoubleArrayBuffer() {
+
+ try{
+
+ // Return this object's reference to the buffer.
+ this->_array->returnRef();
+
+ // If there are no other Buffers out there that reference it then we
+ // delete it now, the internal unsigned char* array will be deleted
+ // if we where the owner.
+ if( this->_array->getReferences() == 0 ) {
+ delete this->_array;
+ }
+ }
+ DECAF_CATCH_NOTHROW( Exception )
+ DECAF_CATCHALL_NOTHROW()
+}
+
///////////////////////////////////////////////////////////////////////////////
double* DoubleArrayBuffer::array()
throw( decaf::lang::exceptions::UnsupportedOperationException,
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/DoubleArrayBuffer.h Wed Feb 6 08:32:35 2008
@@ -91,7 +91,7 @@
*/
DoubleArrayBuffer( const DoubleArrayBuffer& other );
- virtual ~DoubleArrayBuffer() {}
+ virtual ~DoubleArrayBuffer();
public:
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.cpp Wed Feb 6 08:32:35 2008
@@ -88,6 +88,25 @@
this->readOnly = other.readOnly;
}
+////////////////////////////////////////////////////////////////////////////////
+FloatArrayBuffer::~FloatArrayBuffer() {
+
+ try{
+
+ // Return this object's reference to the buffer.
+ this->_array->returnRef();
+
+ // If there are no other Buffers out there that reference it then we
+ // delete it now, the internal unsigned char* array will be deleted
+ // if we where the owner.
+ if( this->_array->getReferences() == 0 ) {
+ delete this->_array;
+ }
+ }
+ DECAF_CATCH_NOTHROW( Exception )
+ DECAF_CATCHALL_NOTHROW()
+}
+
///////////////////////////////////////////////////////////////////////////////
float* FloatArrayBuffer::array()
throw( decaf::lang::exceptions::UnsupportedOperationException,
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/FloatArrayBuffer.h Wed Feb 6 08:32:35 2008
@@ -91,7 +91,7 @@
*/
FloatArrayBuffer( const FloatArrayBuffer& other );
- virtual ~FloatArrayBuffer() {}
+ virtual ~FloatArrayBuffer();
public:
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.cpp Wed Feb 6 08:32:35 2008
@@ -88,6 +88,25 @@
this->readOnly = other.readOnly;
}
+////////////////////////////////////////////////////////////////////////////////
+IntArrayBuffer::~IntArrayBuffer() {
+
+ try{
+
+ // Return this object's reference to the buffer.
+ this->_array->returnRef();
+
+ // If there are no other Buffers out there that reference it then we
+ // delete it now, the internal unsigned char* array will be deleted
+ // if we where the owner.
+ if( this->_array->getReferences() == 0 ) {
+ delete this->_array;
+ }
+ }
+ DECAF_CATCH_NOTHROW( Exception )
+ DECAF_CATCHALL_NOTHROW()
+}
+
///////////////////////////////////////////////////////////////////////////////
int* IntArrayBuffer::array()
throw( decaf::lang::exceptions::UnsupportedOperationException,
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/IntArrayBuffer.h Wed Feb 6 08:32:35 2008
@@ -91,7 +91,7 @@
*/
IntArrayBuffer( const IntArrayBuffer& other );
- virtual ~IntArrayBuffer() {}
+ virtual ~IntArrayBuffer();
public:
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.cpp Wed Feb 6 08:32:35 2008
@@ -88,6 +88,25 @@
this->readOnly = other.readOnly;
}
+////////////////////////////////////////////////////////////////////////////////
+LongArrayBuffer::~LongArrayBuffer() {
+
+ try{
+
+ // Return this object's reference to the buffer.
+ this->_array->returnRef();
+
+ // If there are no other Buffers out there that reference it then we
+ // delete it now, the internal unsigned char* array will be deleted
+ // if we where the owner.
+ if( this->_array->getReferences() == 0 ) {
+ delete this->_array;
+ }
+ }
+ DECAF_CATCH_NOTHROW( Exception )
+ DECAF_CATCHALL_NOTHROW()
+}
+
///////////////////////////////////////////////////////////////////////////////
long long* LongArrayBuffer::array()
throw( decaf::lang::exceptions::UnsupportedOperationException,
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/LongArrayBuffer.h Wed Feb 6 08:32:35 2008
@@ -91,7 +91,7 @@
*/
LongArrayBuffer( const LongArrayBuffer& other );
- virtual ~LongArrayBuffer() {}
+ virtual ~LongArrayBuffer();
public:
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.cpp Wed Feb 6 08:32:35 2008
@@ -88,6 +88,25 @@
this->readOnly = other.readOnly;
}
+////////////////////////////////////////////////////////////////////////////////
+ShortArrayBuffer::~ShortArrayBuffer() {
+
+ try{
+
+ // Return this object's reference to the buffer.
+ this->_array->returnRef();
+
+ // If there are no other Buffers out there that reference it then we
+ // delete it now, the internal unsigned char* array will be deleted
+ // if we where the owner.
+ if( this->_array->getReferences() == 0 ) {
+ delete this->_array;
+ }
+ }
+ DECAF_CATCH_NOTHROW( Exception )
+ DECAF_CATCHALL_NOTHROW()
+}
+
///////////////////////////////////////////////////////////////////////////////
short* ShortArrayBuffer::array()
throw( decaf::lang::exceptions::UnsupportedOperationException,
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ShortArrayBuffer.h Wed Feb 6 08:32:35 2008
@@ -91,7 +91,7 @@
*/
ShortArrayBuffer( const ShortArrayBuffer& other );
- virtual ~ShortArrayBuffer() {}
+ virtual ~ShortArrayBuffer();
public:
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp Wed Feb 6 08:32:35 2008
@@ -150,7 +150,7 @@
try{
if( own ) {
- delete array.bytes;
+ delete [] array.bytes;
}
}
DECAF_CATCH_NOTHROW( Exception )
@@ -239,7 +239,7 @@
this->array.bytes = new unsigned char[capacity];
this->capacity = capacity;
memcpy( this->array.bytes, oldArray, Math::min( (int)oldCapacity, (int)capacity ) );
- delete oldArray;
+ delete [] oldArray;
}
DECAF_CATCH_RETHROW( InvalidStateException )
DECAF_CATCHALL_THROW( InvalidStateException )
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.cpp Wed Feb 6 08:32:35 2008
@@ -388,12 +388,13 @@
return target->remaining() == 0 ? 0 : string::npos;
}
- std::size_t result = (std::size_t)Math::min(
- (int)target->remaining(),
+ std::size_t result = (std::size_t)Math::min(
+ (int)target->remaining(),
(int)this->remaining() );
char* chars = new char[result];
get( chars, 0, result );
target->put( chars, 0, result );
+ delete [] chars;
return result;
}
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp Wed Feb 6 08:32:35 2008
@@ -126,6 +126,8 @@
CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->limit() );
testBuffer1->reset();
CPPUNIT_ASSERT( testBuffer1->position() == 0);
+
+ delete readOnly;
}
////////////////////////////////////////////////////////////////////////////////
@@ -242,7 +244,7 @@
delete empty;
delete wrapped;
delete other;
- delete data;
+ delete [] data;
}
////////////////////////////////////////////////////////////////////////////////
@@ -373,8 +375,8 @@
CPPUNIT_ASSERT( &ret == testBuffer1);
- delete array;
- delete array2;
+ delete [] array;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
@@ -491,6 +493,9 @@
CPPUNIT_ASSERT( testBuffer1->get( ix ) == array[ix] );
}
CPPUNIT_ASSERT( &ret == testBuffer1 );
+
+ delete [] array;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayBufferTest.h Wed Feb 6 08:32:35 2008
@@ -102,7 +102,7 @@
void tearDown() {
delete testBuffer1;
- delete testData1;
+ delete [] testData1;
}
void test();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayPerspectiveTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayPerspectiveTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayPerspectiveTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ByteArrayPerspectiveTest.cpp Wed Feb 6 08:32:35 2008
@@ -57,8 +57,8 @@
CPPUNIT_ASSERT( data[i] == result[i] );
}
- delete data;
- delete result;
+ delete [] data;
+ delete [] result;
}
////////////////////////////////////////////////////////////////////////////////
@@ -81,8 +81,8 @@
CPPUNIT_ASSERT( data[i] == result[i] );
}
- delete data;
- delete result;
+ delete [] data;
+ delete [] result;
}
////////////////////////////////////////////////////////////////////////////////
@@ -144,8 +144,8 @@
CPPUNIT_ASSERT( result[i] == 0 );
}
- delete data;
- delete result;
+ delete [] data;
+ delete [] result;
}
////////////////////////////////////////////////////////////////////////////////
@@ -177,8 +177,9 @@
CPPUNIT_ASSERT( result[i] == data[i] );
}
- delete result;
- delete result2;
+ delete [] data;
+ delete [] result;
+ delete [] result2;
}
////////////////////////////////////////////////////////////////////////////////
@@ -197,7 +198,7 @@
CPPUNIT_ASSERT( data[i] == array[i] );
}
- delete data;
+ delete [] data;
}
////////////////////////////////////////////////////////////////////////////////
@@ -222,7 +223,6 @@
"Should Throw BufferUnderflowException",
array.read( result, 0, 500 ),
BufferUnderflowException );
-
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.cpp Wed Feb 6 08:32:35 2008
@@ -126,6 +126,8 @@
CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->limit() );
testBuffer1->reset();
CPPUNIT_ASSERT( testBuffer1->position() == 0);
+
+ delete readOnly;
}
////////////////////////////////////////////////////////////////////////////////
@@ -242,7 +244,7 @@
delete empty;
delete wrapped;
delete other;
- delete data;
+ delete [] data;
}
////////////////////////////////////////////////////////////////////////////////
@@ -373,8 +375,8 @@
CPPUNIT_ASSERT( &ret == testBuffer1);
- delete array;
- delete array2;
+ delete [] array;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
@@ -491,6 +493,9 @@
CPPUNIT_ASSERT( testBuffer1->get( ix ) == array[ix] );
}
CPPUNIT_ASSERT( &ret == testBuffer1 );
+
+ delete [] array;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
@@ -658,6 +663,7 @@
CharSequence* sub2 = testBuffer1->subSequence( 0, testBuffer1->length() );
CPPUNIT_ASSERT( sub2->toString() == testBuffer1->toString() );
+ delete sub2;
}
////////////////////////////////////////////////////////////////////////////////
@@ -742,6 +748,7 @@
cb->clear();
CPPUNIT_ASSERT( cb2->equals( *cb ) );
+ delete cb2;
cb->put( "abc" );
cb2 = cb->duplicate();
cb->append( cb );
@@ -750,6 +757,7 @@
cb2->clear();
CPPUNIT_ASSERT( cb2->equals( *cb ) );
+ delete cb2;
cb->put( "edfg" );
cb->clear();
cb2 = cb->duplicate();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/CharArrayBufferTest.h Wed Feb 6 08:32:35 2008
@@ -144,7 +144,7 @@
void tearDown() {
delete testBuffer1;
- delete testData1;
+ delete [] testData1;
}
void test();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp Wed Feb 6 08:32:35 2008
@@ -354,7 +354,7 @@
assertContentEquals( testBuffer1, array, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -414,7 +414,7 @@
testBuffer1->put( array, 0, 1 ),
BufferOverflowException );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -441,6 +441,9 @@
CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
+
+ delete [] array1;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h Wed Feb 6 08:32:35 2008
@@ -77,7 +77,7 @@
void tearDown() {
delete testBuffer1;
- delete testData1;
+ delete [] testData1;
}
void test();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp Wed Feb 6 08:32:35 2008
@@ -354,7 +354,7 @@
assertContentEquals( testBuffer1, array, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -414,7 +414,7 @@
testBuffer1->put( array, 0, 1 ),
BufferOverflowException );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -441,6 +441,9 @@
CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
+
+ delete [] array1;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.h Wed Feb 6 08:32:35 2008
@@ -77,7 +77,7 @@
void tearDown() {
delete testBuffer1;
- delete testData1;
+ delete [] testData1;
}
void test();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.cpp Wed Feb 6 08:32:35 2008
@@ -354,7 +354,7 @@
assertContentEquals( testBuffer1, array, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -414,7 +414,7 @@
testBuffer1->put( array, 0, 1 ),
BufferOverflowException );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -441,6 +441,9 @@
CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
+
+ delete [] array1;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/IntArrayBufferTest.h Wed Feb 6 08:32:35 2008
@@ -77,7 +77,7 @@
void tearDown() {
delete testBuffer1;
- delete testData1;
+ delete [] testData1;
}
void test();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.cpp Wed Feb 6 08:32:35 2008
@@ -355,7 +355,7 @@
assertContentEquals( testBuffer1, array, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -415,7 +415,7 @@
testBuffer1->put( array, 0, 1 ),
BufferOverflowException );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -442,6 +442,9 @@
CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
+
+ delete [] array1;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/LongArrayBufferTest.h Wed Feb 6 08:32:35 2008
@@ -77,7 +77,7 @@
void tearDown() {
delete testBuffer1;
- delete testData1;
+ delete [] testData1;
}
void test();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp Wed Feb 6 08:32:35 2008
@@ -354,7 +354,7 @@
assertContentEquals( testBuffer1, array, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -414,7 +414,7 @@
testBuffer1->put( array, 0, 1 ),
BufferOverflowException );
- delete array;
+ delete [] array;
}
////////////////////////////////////////////////////////////////////////////////
@@ -441,6 +441,9 @@
CPPUNIT_ASSERT( testBuffer1->position() == testBuffer1->capacity() );
assertContentEquals( testBuffer1, array1, 0, testBuffer1->capacity() );
CPPUNIT_ASSERT( &ret == testBuffer1 );
+
+ delete [] array1;
+ delete [] array2;
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/ShortArrayBufferTest.h Wed Feb 6 08:32:35 2008
@@ -77,7 +77,7 @@
void tearDown() {
delete testBuffer1;
- delete testData1;
+ delete [] testData1;
}
void test();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp Wed Feb 6 08:32:35 2008
@@ -65,8 +65,8 @@
CPPUNIT_ASSERT( data[i] == result[i] );
}
- delete data;
- delete result;
+ delete [] data;
+ delete [] result;
}
////////////////////////////////////////////////////////////////////////////////
@@ -89,8 +89,8 @@
CPPUNIT_ASSERT( data[i] == result[i] );
}
- delete data;
- delete result;
+ delete [] data;
+ delete [] result;
}
////////////////////////////////////////////////////////////////////////////////
@@ -152,8 +152,8 @@
CPPUNIT_ASSERT( result[i] == 0 );
}
- delete data;
- delete result;
+ delete [] data;
+ delete [] result;
}
////////////////////////////////////////////////////////////////////////////////
@@ -185,8 +185,9 @@
CPPUNIT_ASSERT( result[i] == data[i] );
}
- delete result;
- delete result2;
+ delete [] data;
+ delete [] result;
+ delete [] result2;
}
////////////////////////////////////////////////////////////////////////////////
@@ -205,7 +206,7 @@
CPPUNIT_ASSERT( data[i] == array[i] );
}
- delete data;
+ delete [] data;
}
////////////////////////////////////////////////////////////////////////////////
@@ -230,6 +231,7 @@
"Should Throw BufferUnderflowException",
array.read( result, 0, 500 ),
BufferUnderflowException );
+
}
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h Wed Feb 6 08:32:35 2008
@@ -74,7 +74,7 @@
}
void tearDown() {
- delete testData1;
+ delete [] testData1;
}
void testRead();
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataInputStreamTest.cpp Wed Feb 6 08:32:35 2008
@@ -75,7 +75,7 @@
is->read( result, 0, testData.length() );
CPPUNIT_ASSERT_MESSAGE("Incorrect data read",
string( (const char*)result, testData.size() ) == testData );
- delete result;
+ delete [] result;
} catch( IOException &e ) {
CPPUNIT_FAIL("IOException during read test : " + e.getMessage());
}
@@ -170,7 +170,7 @@
is->readFully( rbytes, 0, testData.length() );
CPPUNIT_ASSERT_MESSAGE("Incorrect data read",
string( (const char*)rbytes, 0, testData.length() ) == testData );
- delete rbytes;
+ delete [] rbytes;
} catch( IOException &e ) {
CPPUNIT_FAIL("IOException during readFully test : " + e.getMessage());
}
@@ -227,7 +227,7 @@
is.readFully( byteArray, 0, Integer::MAX_VALUE ),
NullPointerException );
- delete byteArray;
+ delete [] byteArray;
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataOutputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataOutputStreamTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataOutputStreamTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/DataOutputStreamTest.cpp Wed Feb 6 08:32:35 2008
@@ -66,7 +66,7 @@
is->close();
CPPUNIT_ASSERT_MESSAGE("Incorrect bytes written",
string( (const char*)rbuf, 150 ) == testData.substr( 0, 150 ) );
- delete rbuf;
+ delete [] rbuf;
} catch( IOException &e ) {
CPPUNIT_FAIL("Exception during write test : " + e.getMessage());
}
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/FilterOutputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/FilterOutputStreamTest.cpp?rev=619056&r1=619055&r2=619056&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/FilterOutputStreamTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/io/FilterOutputStreamTest.cpp Wed Feb 6 08:32:35 2008
@@ -85,7 +85,7 @@
CPPUNIT_ASSERT_MESSAGE("Incorrect bytes written",
testString == string( (const char*)wbytes, testString.length() ) );
- delete wbytes;
+ delete [] wbytes;
} catch( IOException& e ) {
CPPUNIT_FAIL("Write test failed : " + e.getMessage());
}