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_r127109680
 
 

 ##########
 File path: pulsar-client-cpp/lib/ClientConnection.cc
 ##########
 @@ -933,23 +933,30 @@ ClientConnection::newConsumerStats(uint64_t consumerId, 
uint64_t requestId) {
         promise.setFailed(ResultNotConnected);
     }
     pendingConsumerStatsMap_.insert(std::make_pair(requestId, promise));
+    const SharedBuffer& buffer = Commands::newConsumerStats(outgoingCmd_, 
consumerId, requestId);
 
 Review comment:
   This should not be a reference, because otherwise the object itself can get 
destroyed before you use it. Just make a regular copy (which is shallow copy, 
`SharedBuffer` is just having a `shared_ptr` internally). 
   
   ```cpp
   SharedBuffer buffer = Commands... 
   ```
 
----------------------------------------------------------------
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

Reply via email to