merlimat commented on a change in pull request #561: Fix: CPP release
baseCommand after serializing it
URL: https://github.com/apache/incubator-pulsar/pull/561#discussion_r127100308
##########
File path: pulsar-client-cpp/lib/Commands.cc
##########
@@ -66,7 +68,9 @@ SharedBuffer Commands::newConsumerStats(BaseCommand& cmd,
uint64_t consumerId, u
CommandConsumerStats* consumerStats = cmd.mutable_consumerstats();
consumerStats->set_consumer_id(consumerId);
consumerStats->set_request_id(requestId);
- return writeMessageWithSize(cmd);
+ const SharedBuffer& buffer = writeMessageWithSize(cmd);
+ cmd.release_consumerstats();
Review comment:
No need to explicitly release here, when `cmd` is destroyed it will clean up
everything it owns.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services