From 616babd5d1d50df61646b23bb6b4200f70dffe45 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Thu, 15 Sep 2016 15:40:52 +0200 Subject: 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: --- .../tests/InterfaceRepo/Persistence_Test/Ptest.cpp | 19 +++++++++++++++++++ .../tests/InterfaceRepo/Persistence_Test/Ptest.h | 3 +++ .../tests/InterfaceRepo/Persistence_Test/test.cpp | 10 ++++++---- 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 @@ -59,6 +59,25 @@ Ptest::init (int argc, ACE_TCHAR *argv[]) return 0; } +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) { 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; } -- cgit v1.2.1