summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-10-20 17:08:49 +0000
committerdai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-10-20 17:08:49 +0000
commitb91c26979abc803ed022faadef32a8865911edf6 (patch)
treed172e00e5b166f1669d4b0e5d83043af04caed46
parent81abe7664ca9eec62c15dfe436a1921db6e6896d (diff)
downloadATCD-b91c26979abc803ed022faadef32a8865911edf6.tar.gz
Fri Oct 20 17:08:01 UTC 2006 General TAO team Account <tao_g@ociweb.com> - importing changes from the HEAD
-rw-r--r--TAO/ChangeLog14
-rw-r--r--TAO/tao/ORB_Core.cpp9
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.cpp13
3 files changed, 31 insertions, 5 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 7c6466edee4..b7a569855fd 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,17 @@
+Fri Oct 20 16:54:32 UTC 2006 Chad Elliott <elliott_c@ociweb.com>
+
+ * tao/ORB_Core.cpp:
+
+ Fixed a memory leak where the TAO_Adapter would be leaked in the
+ event that an exception occurred before the adapter was added to
+ the adapter registry.
+
+ * tao/PortableServer/Object_Adapter.cpp:
+
+ Clean up the TAO_Root_POA and TAO_POAManager_Factory pointers in
+ the destructor in the event that the close() method was never
+ called.
+
Fri Oct 20 07:44:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
* tao/Transport_Connector.cpp:
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index d347298dc96..86548d59087 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -51,6 +51,7 @@
#include "ace/Arg_Shifter.h"
#include "ace/Argv_Type_Converter.h"
#include "ace/Static_Object_Lock.h"
+#include "ace/Auto_Ptr.h"
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
@@ -1856,9 +1857,7 @@ TAO_ORB_Core::root_poa (ACE_ENV_SINGLE_ARG_DECL)
if (CORBA::is_nil (this->root_poa_.in ()))
{
- // @@ Not exception safe
- TAO_Adapter *poa_adapter =
- factory->create (this);
+ auto_ptr<TAO_Adapter> poa_adapter (factory->create (this));
poa_adapter->open (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::Object::_nil ());
@@ -1867,9 +1866,11 @@ TAO_ORB_Core::root_poa (ACE_ENV_SINGLE_ARG_DECL)
this->root_poa_ =
poa_adapter->root ();
- this->adapter_registry_.insert (poa_adapter
+ this->adapter_registry_.insert (poa_adapter.get ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ poa_adapter.release ();
}
}
diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp
index a637f17951c..ae2848d2158 100644
--- a/TAO/tao/PortableServer/Object_Adapter.cpp
+++ b/TAO/tao/PortableServer/Object_Adapter.cpp
@@ -307,6 +307,17 @@ TAO_Object_Adapter::~TAO_Object_Adapter (void)
delete this->lock_;
delete this->servant_dispatcher_;
+
+ // This cleanup may have already occurred in the close() method. If
+ // that is the case then this won't cause any harm since root_ and
+ // poa_manager_factory_ would have been set to zero. But, if close
+ // wasn't called, then these would be leaked. It may be better if
+ // these pointers had a corresponding _var version so that this cleanup
+ // could be automatic.
+ ::CORBA::release (this->root_);
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ ::CORBA::release (this->poa_manager_factory_);
+#endif
}
/* static */
@@ -646,7 +657,7 @@ TAO_Object_Adapter::open (ACE_ENV_SINGLE_ARG_DECL)
CORBA::COMPLETED_NO));
ACE_CHECK;
- // Keep reference of POAManager in TAO_Object_Adapter so the POAManager
+ // Keep reference of POAManager in TAO_Object_Adapter so the POAManager
// object is detructed after RootPOA is destructed.
the_poa_manager_ = poa_manager;