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/11/02 21:26:13 UTC

svn commit: r709920 - /activemq/activemq-cpp/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp

Author: tabish
Date: Sun Nov  2 12:26:12 2008
New Revision: 709920

URL: http://svn.apache.org/viewvc?rev=709920&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-200

Fix possible memory leak

Modified:
    activemq/activemq-cpp/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp

Modified: activemq/activemq-cpp/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp?rev=709920&r1=709919&r2=709920&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/internal/nio/CharArrayBuffer.cpp Sun Nov  2 12:26:12 2008
@@ -188,9 +188,9 @@
 
         // copy from the current pos to the beginning all the remaining bytes
         // the set pos to the
-        memcpy( this->array() + offset,
-                this->array() + offset + this->position(),
-                this->remaining() );
+        for( std::size_t ix = 0; ix < this->remaining(); ++ix ) {
+            this->put( ix, this->get( this->position() + ix ) );
+        }
 
         this->position( this->limit() - this->position() );
         this->limit( this->capacity() );