diff options
author | vridosh <vridosh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-07-26 09:26:46 +0000 |
---|---|---|
committer | vridosh <vridosh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-07-26 09:26:46 +0000 |
commit | 99b4c584497b99d6c4d7c302e1d368b612a444b5 (patch) | |
tree | 3f6640b950df99091d9e1cd2e221b33aec9c3cdd | |
parent | 94531288a4dae2ed3c9d7bfd2348c14066c03f69 (diff) | |
download | ATCD-99b4c584497b99d6c4d7c302e1d368b612a444b5.tar.gz |
ChangeLogTag: Thu Jul 26 09:21:50 UTC 2007 Vadym Ridosh <vridosh@prismtech.com>
-rw-r--r-- | TAO/ChangeLog | 8 | ||||
-rw-r--r-- | TAO/tao/Strategies/DIOP_Acceptor.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/Strategies/DIOP_Connector.cpp | 10 |
3 files changed, 19 insertions, 9 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index d2c1fbf5fc6..a77736158bb 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,11 @@ +Thu Jul 26 09:21:50 UTC 2007 Vadym Ridosh <vridosh@prismtech.com> + + * tao/Strategies/DIOP_Connector.cpp: + * tao/Strategies/DIOP_Acceptor.cpp: + The previous attempt to fix potential memory leaks when + connection handler is allocated but later code fails was + not completely correct. Now it's fixed. + Tue Jul 24 20:38:50 UTC 2007 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> * COPYING: Updated this file to reflect 2007. diff --git a/TAO/tao/Strategies/DIOP_Acceptor.cpp b/TAO/tao/Strategies/DIOP_Acceptor.cpp index d0ec021bd50..4571d1f572c 100644 --- a/TAO/tao/Strategies/DIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/DIOP_Acceptor.cpp @@ -239,7 +239,7 @@ TAO_DIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint) int TAO_DIOP_Acceptor::close (void) { - return this->connection_handler_->peer ().close (); + return 0; } int @@ -418,8 +418,8 @@ TAO_DIOP_Acceptor::open_i (const ACE_INET_Addr& addr, ACE_Event_Handler::READ_MASK); if (result == -1) { + // Close the handler (this will also delete connection_handler_). this->connection_handler_->close (); - delete this->connection_handler_; return result; } @@ -979,7 +979,7 @@ TAO_DIOP_Acceptor::parse_options (const char *str) static const char option_delimiter = '&'; // Count the number of options. - int option_count = 1; + CORBA::ULong option_count = 1; // Only check for endpoints after the protocol specification and // before the object key. @@ -998,13 +998,15 @@ TAO_DIOP_Acceptor::parse_options (const char *str) ACE_CString::size_type begin = 0; ACE_CString::size_type end = 0; - for (int j = 0; j < option_count; ++j) + for (CORBA::ULong j = 0; j < option_count;) { if (j < option_count - 1) end = options.find (option_delimiter, begin); else end = len; + ++j; // In this way we fight MS VS warning about unreachable code. + if (end == begin) { ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/tao/Strategies/DIOP_Connector.cpp b/TAO/tao/Strategies/DIOP_Connector.cpp index 5389a4fbd9e..15ec920293b 100644 --- a/TAO/tao/Strategies/DIOP_Connector.cpp +++ b/TAO/tao/Strategies/DIOP_Connector.cpp @@ -151,6 +151,9 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, // Failure to open a connection. if (retval != 0) { + // Close the handler (this will also delete svc_handler). + svc_handler->close (); + if (TAO_debug_level > 0) { ACE_ERROR ((LM_ERROR, @@ -158,7 +161,6 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, ACE_TEXT ("could not make a new connection\n"))); } - delete svc_handler; return 0; } @@ -174,7 +176,7 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, // In case of errors transport is zero if (transport == 0) { - // Close the handler. + // Close the handler (this will also delete svc_handler). svc_handler->close (); // Give users a clue to the problem. @@ -186,7 +188,6 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, diop_endpoint->port (), ACE_TEXT ("errno"))); - delete svc_handler; return 0; } @@ -198,7 +199,7 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, // Failure in adding to cache. if (retval != 0) { - // Close the handler. + // Close the handler (this will also delete svc_handler). svc_handler->close (); if (TAO_debug_level > 0) @@ -208,7 +209,6 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, ACE_TEXT ("could not add the new connection to cache\n"))); } - delete svc_handler; return 0; } |