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 2014/02/19 20:21:59 UTC

git commit: https://issues.apache.org/jira/browse/AMQCPP-533

Repository: activemq-cpp
Updated Branches:
  refs/heads/trunk ec8af34d7 -> b29a30634


https://issues.apache.org/jira/browse/AMQCPP-533

apply patch for memory leak in Stomp when sending BytesMessage 

Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/b29a3063
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/b29a3063
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/b29a3063

Branch: refs/heads/trunk
Commit: b29a30634236e808a43d22d2cd16057e183238ab
Parents: ec8af34
Author: Timothy Bish <ta...@gmai.com>
Authored: Wed Feb 19 14:21:50 2014 -0500
Committer: Timothy Bish <ta...@gmai.com>
Committed: Wed Feb 19 14:21:50 2014 -0500

----------------------------------------------------------------------
 .../src/main/activemq/wireformat/stomp/StompWireFormat.cpp     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/b29a3063/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp b/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp
index 6323196..1423717 100644
--- a/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp
+++ b/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp
@@ -366,8 +366,12 @@ Pointer<StompFrame> StompWireFormat::marshalMessage(const Pointer<Command> comma
 
     try {
         Pointer<ActiveMQBytesMessage> bytesMessage = message.dynamicCast<ActiveMQBytesMessage>();
-        frame->setBody(bytesMessage->getBodyBytes(), bytesMessage->getBodyLength());
+        unsigned char* bodyBytes = bytesMessage->getBodyBytes();
+        frame->setBody(bodyBytes, bytesMessage->getBodyLength());
         frame->setProperty(StompCommandConstants::HEADER_CONTENTLENGTH, Long::toString(bytesMessage->getBodyLength()));
+        if (bodyBytes) {
+            delete [] bodyBytes;
+        }
         return frame;
     } catch (ClassCastException& ex) {
     }