Repository: activemq-cpp Updated Branches: refs/heads/3.8.x b2c6ec3d8 -> d26d2c9ba
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/d26d2c9b Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/d26d2c9b Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/d26d2c9b Branch: refs/heads/3.8.x Commit: d26d2c9baf40e3dd4b18c1cb83a19eb8777a767d Parents: b2c6ec3 Author: Timothy Bish <[email protected]> Authored: Wed Feb 19 14:21:50 2014 -0500 Committer: Timothy Bish <[email protected]> Committed: Wed Feb 19 14:23:03 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/d26d2c9b/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) { }
