diff options
author | stanleyk <stanleyk@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2013-02-18 18:41:09 +0000 |
---|---|---|
committer | stanleyk <stanleyk@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2013-02-18 18:41:09 +0000 |
commit | 46fa815edd399a93817b7bc620c1a120ca84d249 (patch) | |
tree | d73cd6bb31dec0ace060d27d366eef6dbc9dfd72 /TAO/orbsvcs/orbsvcs | |
parent | e8038fbd94d34a543243991535ca9559e3ebe2a3 (diff) | |
download | ATCD-46fa815edd399a93817b7bc620c1a120ca84d249.tar.gz |
Various fixes for memory leaks and null pointer checks.
Diffstat (limited to 'TAO/orbsvcs/orbsvcs')
6 files changed, 29 insertions, 11 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp index 72b836a1c9f..2c04507eee2 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp @@ -69,7 +69,10 @@ int TAO_Naming_Loader::fini (void) { // Remove the Naming Service. - return this->naming_server_->fini (); + if (this->naming_server_ == 0) + return 0; + else + return this->naming_server_->fini (); } CORBA::Object_ptr diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp index d6150e4580e..a393b597a5f 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp @@ -437,7 +437,7 @@ TAO_Naming_Server::init_with_orb (int argc, ACE_TEXT_ALWAYS_CHAR (this->ior_file_name_)) != 0) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT("Unable to open %s for writing:(%u) %p\n"), + ACE_TEXT("Unable to open %C for writing:(%u) %p\n"), this->ior_file_name_, ACE_ERRNO_GET, ACE_TEXT("TAO_Naming_Server::init_with_orb")), diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp index 2f5c1da2f03..cdd9b95802a 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp @@ -329,8 +329,20 @@ void TAO_Storable_Naming_Context:: File_Open_Lock_and_Check::load_from_stream () { + if (context_ == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) File_Open_Lock_and_Check::load_from_stream -") + ACE_TEXT ("null context_ encountered."))); + throw CORBA::INTERNAL (); + } // Throw our map away - delete context_->storable_context_; + if (context_->storable_context_) + { + delete context_->storable_context_; + context_->storable_context_ = 0; + } + // and build a new one from disk context_->load_map (this->peer()); } diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context_ReaderWriter.cpp b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context_ReaderWriter.cpp index c21b331f6d9..35a94aa7cc6 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context_ReaderWriter.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context_ReaderWriter.cpp @@ -175,7 +175,10 @@ TAO_Storable_Naming_Context_ReaderWriter::read (TAO_Storable_Naming_Context & co } context.storable_context_ = bindings_map; context.context_ = context.storable_context_; - return 0; + if (stream_.good ()) + return 0; + else + return -1; } void diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp index 5d05668cf2f..44455231bfd 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp @@ -67,7 +67,7 @@ TAO::PG_Object_Group::PG_Object_Group ( , distribute_ (1) , empty_ (1) , role_ (type_id) - , type_id_ (CORBA::string_dup (type_id)) + , type_id_ (type_id) , tagged_component_ (tagged_component) , reference_ (CORBA::Object::_duplicate(empty_group)) , group_name_ (0) diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp index 2ac1c0efe67..946ecae9632 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp @@ -484,9 +484,9 @@ TAO::PG_Object_Group_Storable::write (TAO::Storable_Base & stream) primary_location_cdr << PG_Object_Group::get_primary_location (); stream << primary_location_cdr; - ACE_CString reference_ior = + CORBA::String_var reference_ior = this->orb_->object_to_string (this->reference_.in ()); - stream << reference_ior; + stream << reference_ior.in (); TAO_OutputCDR tagged_component_cdr; tagged_component_cdr << this->tagged_component_; @@ -516,17 +516,17 @@ TAO::PG_Object_Group_Storable::write (TAO::Storable_Base & stream) stream << the_location_cdr; MemberInfo * member = it->item (); - ACE_CString member_ior = + CORBA::String_var member_ior = this->orb_->object_to_string (member->member_.in ()); - stream << member_ior; + stream << member_ior.in (); TAO_OutputCDR location_cdr; location_cdr << member->location_; stream << location_cdr; - ACE_CString factory_ior = + CORBA::String_var factory_ior = this->orb_->object_to_string (member->factory_.in ()); - stream << factory_ior; + stream << factory_ior.in (); TAO_OutputCDR factory_id_cdr; factory_id_cdr << member->factory_id_; |