You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/01/04 03:07:17 UTC

[GitHub] ShannonDing closed pull request #50: Fix push consumer dtor segfault

ShannonDing closed pull request #50: Fix push consumer dtor segfault
URL: https://github.com/apache/rocketmq-client-cpp/pull/50
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/consumer/DefaultMQPushConsumer.cpp b/src/consumer/DefaultMQPushConsumer.cpp
index 70c9b888..96e5ec20 100644
--- a/src/consumer/DefaultMQPushConsumer.cpp
+++ b/src/consumer/DefaultMQPushConsumer.cpp
@@ -226,11 +226,21 @@ void DefaultMQPushConsumer::boost_asio_work() {
 
 DefaultMQPushConsumer::~DefaultMQPushConsumer() {
   m_pMessageListener = NULL;
-  deleteAndZero(m_pullmsgQueue);
-  deleteAndZero(m_pRebalance);
-  deleteAndZero(m_pOffsetStore);
-  deleteAndZero(m_pPullAPIWrapper);
-  deleteAndZero(m_consumerService);
+  if (m_pullmsgQueue != NULL) {
+    deleteAndZero(m_pullmsgQueue);
+  }
+  if (m_pRebalance != NULL) {
+    deleteAndZero(m_pRebalance);
+  }
+  if (m_pOffsetStore != NULL) {
+    deleteAndZero(m_pOffsetStore);
+  }
+  if (m_pPullAPIWrapper != NULL) {
+    deleteAndZero(m_pPullAPIWrapper);
+  }
+  if (m_consumerService != NULL) {
+    deleteAndZero(m_consumerService);
+  }
   PullMAP::iterator it = m_PullCallback.begin();
   for (; it != m_PullCallback.end(); ++it) {
     deleteAndZero(it->second);


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services