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_r127103952
##########
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:
But, after this change, the `cmd` is local to this method and thus will be
destroyed one line below. At that point, it will destroy all the sub-objects.
----------------------------------------------------------------
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