From 5a66fa9c3a3c1d265808ee2049dabaef4bf1a3db Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 13 Feb 2023 14:01:06 +0100 Subject: Check for nil pointers in cleanup * TAO/tao/PortableServer/Active_Policy_Strategies.cpp: --- .../PortableServer/Active_Policy_Strategies.cpp | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/TAO/tao/PortableServer/Active_Policy_Strategies.cpp b/TAO/tao/PortableServer/Active_Policy_Strategies.cpp index b457efcdc4f..a2a2ce4319b 100644 --- a/TAO/tao/PortableServer/Active_Policy_Strategies.cpp +++ b/TAO/tao/PortableServer/Active_Policy_Strategies.cpp @@ -42,22 +42,22 @@ namespace TAO this->create (policies.request_processing(), policies.servant_retention()); /**/ - if (this->lifespan_strategy_ != 0) + if (this->lifespan_strategy_) { this->lifespan_strategy_->strategy_init (poa); } - if (this->request_processing_strategy_ != 0) + if (this->request_processing_strategy_) { this->request_processing_strategy_->strategy_init (poa); } - if (this->id_uniqueness_strategy_ != 0) + if (this->id_uniqueness_strategy_) { this->id_uniqueness_strategy_->strategy_init (poa); } - if (this->servant_retention_strategy_ != 0) + if (this->servant_retention_strategy_) { this->servant_retention_strategy_->strategy_init (poa); } @@ -66,15 +66,27 @@ namespace TAO void Active_Policy_Strategies::cleanup () { - this->lifespan_strategy_->strategy_cleanup (); + if (this->lifespan_strategy_) + { + this->lifespan_strategy_->strategy_cleanup (); + } this->lifespan_strategy_.reset (nullptr); - this->request_processing_strategy_->strategy_cleanup (); + if (this->request_processing_strategy_) + { + this->request_processing_strategy_->strategy_cleanup (); + } this->request_processing_strategy_.reset (nullptr); - this->id_uniqueness_strategy_->strategy_cleanup (); + if (this->id_uniqueness_strategy_) + { + this->id_uniqueness_strategy_->strategy_cleanup (); + } this->id_uniqueness_strategy_.reset (nullptr); this->implicit_activation_strategy_.reset (nullptr); this->thread_strategy_.reset (nullptr); - this->servant_retention_strategy_->strategy_cleanup (); + if (this->servant_retention_strategy_) + { + this->servant_retention_strategy_->strategy_cleanup (); + } this->servant_retention_strategy_.reset (nullptr); this->id_assignment_strategy_.reset (nullptr); } -- cgit v1.2.1