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 <[email protected]> Authored: Wed Feb 19 14:21:50 2014 -0500 Committer: Timothy Bish <[email protected]> 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) { }
