diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2016-09-15 15:40:52 +0200 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2016-09-15 15:40:52 +0200 |
commit | 616babd5d1d50df61646b23bb6b4200f70dffe45 (patch) | |
tree | bf16c27eae742c251332c88c912176500c9384a6 | |
parent | 7dfbcfae901c1431702549a81cc47d1fd43a61bb (diff) | |
download | ATCD-616babd5d1d50df61646b23bb6b4200f70dffe45.tar.gz |
Added shutdown to cleanly shutdown the ORB and release all CORBA resources to resolve several valgrind reported memory leaks
* TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.cpp:
* TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.h:
* TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/test.cpp:
3 files changed, 28 insertions, 4 deletions
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.cpp index c8f86a137ad..d18b5883ec6 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.cpp @@ -60,6 +60,25 @@ Ptest::init (int argc, ACE_TCHAR *argv[]) } int +Ptest::shutdown (void) +{ + try + { + this->repo_ = CORBA::Repository::_nil (); + + this->orb_->destroy (); + + this->orb_ = CORBA::ORB::_nil (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Ptest::init"); + return -1; + } + return 0; +} + +int Ptest::run (void) { try diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.h b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.h index 6e675fc1f70..5f6c61df0fb 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.h +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.h @@ -45,6 +45,9 @@ public: /// Execute test code. int run (void); + /// Cleanup + int shutdown (void); + private: /// The two IFR tests. void populate (void); diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/test.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/test.cpp index 7d5829a5a78..a3ee919438d 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/test.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/test.cpp @@ -5,12 +5,14 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { Ptest ptest; - int retval = ptest.init (argc, argv); + if (ptest.init (argc, argv) == -1) + return 1; - if (retval == -1) + if (ptest.run () == -1) return 1; - retval = ptest.run (); + if (ptest.shutdown () == -1) + return 1; - return retval; + return 0; } |