You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/05/19 00:49:36 UTC
[pulsar] 21/26: Fix segfault in c++ producer (#4219)
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit cfaa1fd5d557bfbd0855d3105a052c95cd9b6cc8
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Tue May 7 00:37:46 2019 +0200
Fix segfault in c++ producer (#4219)
The sendTimer_ may not be initialized if connection doesn't come up
correctly.
---
pulsar-client-cpp/lib/ProducerImpl.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pulsar-client-cpp/lib/ProducerImpl.cc b/pulsar-client-cpp/lib/ProducerImpl.cc
index d738a44..5cf799b 100644
--- a/pulsar-client-cpp/lib/ProducerImpl.cc
+++ b/pulsar-client-cpp/lib/ProducerImpl.cc
@@ -673,7 +673,9 @@ void ProducerImpl::start() { HandlerBase::start(); }
void ProducerImpl::shutdown() {
Lock lock(mutex_);
state_ = Closed;
- sendTimer_->cancel();
+ if (sendTimer_) {
+ sendTimer_->cancel();
+ }
producerCreatedPromise_.setFailed(ResultAlreadyClosed);
}