summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2005-02-28 19:30:26 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2005-02-28 19:30:26 +0000
commit10fbf92a6f27a6426eca8391579c5cbffff03571 (patch)
tree7edf3430ff62c6cebaf596638f94b4642eae8459
parent6cecdac2bc43345dba9e5cb78dcb40f58ceb31d8 (diff)
downloadATCD-10fbf92a6f27a6426eca8391579c5cbffff03571.tar.gz
ChangeLog tag:Mon Feb 28 13:29:36 2005 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r--TAO/ChangeLog20
-rw-r--r--TAO/tao/CORBALOC_Parser.cpp34
-rw-r--r--TAO/tao/CORBALOC_Parser.h11
-rw-r--r--TAO/tao/CORBALOC_Parser.i14
4 files changed, 65 insertions, 14 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index d8dabbf5e72..fa695385f8c 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,23 @@
+Mon Feb 28 13:29:36 2005 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * tao/CORBALOC_Parser.cpp:
+ * tao/CORBALOC_Parser.h:
+ * tao/CORBALOC_Parser.i:
+
+ Fixed a memory leak resulting from incorrect reference count
+ management in the corbaloc parser. The bad code was using
+ mprofile::add_profile to assign the profile, then releasing its
+ reference without decrementing the count. Since add_profile
+ increments, this caused the failure. Replacing add_profile with
+ give_profile is the best fix, since give_profile is what we
+ really want to do.
+
+ Changes in CORBALOC_Parser.[h,i] move inlined ctor/dtor code out
+ of the header proper and into the inline file. The dtor also
+ does the right thing of explicitly decrementing the reference
+ count of any profile not given away to the mprofile.
+
+
Mon Feb 28 19:21:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
* orbsvcs/tests/Notify/PluggableTopology/PlugTop.mpc:
diff --git a/TAO/tao/CORBALOC_Parser.cpp b/TAO/tao/CORBALOC_Parser.cpp
index 8d54c22764a..1dbfa2424c9 100644
--- a/TAO/tao/CORBALOC_Parser.cpp
+++ b/TAO/tao/CORBALOC_Parser.cpp
@@ -8,7 +8,6 @@
#include "tao/debug.h"
#include "ace/Vector_T.h"
#include "ace/INET_Addr.h"
-#include "ace/os_include/os_netdb.h"
#if !defined(__ACE_INLINE__)
#include "CORBALOC_Parser.i"
@@ -169,8 +168,9 @@ TAO_CORBALOC_Parser::parse_string (const char * ior,
{
if (TAO_debug_level)
ACE_ERROR ((LM_ERROR,
- "(%P|%t) TAO_CORBALOC_Parser::parse_string "
- "could not parse from %s",ior));
+ ACE_TEXT("(%P|%t) TAO_CORBALOC_Parser::parse_string ")
+ ACE_TEXT("could not parse from %s"),
+ ACE_TEXT_CHAR_TO_TCHAR(ior)));
ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10,
CORBA::COMPLETED_NO),
CORBA::Object::_nil ());
@@ -195,8 +195,9 @@ TAO_CORBALOC_Parser::parse_string (const char * ior,
// anything else is a violation.
if (TAO_debug_level)
ACE_ERROR ((LM_ERROR,
- "(%P|%t) TAO_CORBALOC_Parser::parse_string "
- "could not parse from %s",ior));
+ ACE_TEXT("(%P|%t) TAO_CORBALOC_Parser::parse_string ")
+ ACE_TEXT("could not parse from %s"),
+ ACE_TEXT_CHAR_TO_TCHAR(ior)));
ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10,
CORBA::COMPLETED_NO),
CORBA::Object::_nil ());
@@ -215,10 +216,25 @@ TAO_CORBALOC_Parser::parse_string (const char * ior,
endpoints[i].obj_key_sep_ +
obj_key;
const char * str = full_ep.c_str();
- endpoints[i].profile_->parse_string (str
- ACE_ENV_ARG_PARAMETER);
- if (mprofile.add_profile(endpoints[i].profile_) != -1)
+ endpoints[i].profile_->parse_string (str ACE_ENV_ARG_PARAMETER);
+ if (mprofile.give_profile(endpoints[i].profile_) != -1)
endpoints[i].profile_ = 0;
+ else
+ {
+ // Although this ought never happen, we want to make some
+ // indication back to the caller, more as an audit trail than
+ // anything else. The only failure possible is that there was
+ // insufficient heap to allocate the mprofile, hence the
+ // mprofile's size is 0, and give_profile fails.
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("(%P|%t) TAO_CORBALOC_Parser::parse_string ")
+ ACE_TEXT("mprofile.give_profile failed for i = %d\n"),
+ i));
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10,
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+ }
}
CORBA::Object_ptr object = CORBA::Object::_nil ();
@@ -299,7 +315,7 @@ TAO_CORBALOC_Parser::make_canonical (const char *ior,
ACE_THROW (CORBA::INV_OBJREF
(CORBA::SystemException::_tao_minor_code
- (0, EINVAL),
+ (TAO_DEFAULT_MINOR_CODE, EINVAL),
CORBA::COMPLETED_NO));
}
else
diff --git a/TAO/tao/CORBALOC_Parser.h b/TAO/tao/CORBALOC_Parser.h
index 254e54050f1..8d891fe77e8 100644
--- a/TAO/tao/CORBALOC_Parser.h
+++ b/TAO/tao/CORBALOC_Parser.h
@@ -14,7 +14,7 @@
#ifndef TAO_CORBALOC_PARSER_H
#define TAO_CORBALOC_PARSER_H
-#include /**/ "ace/pre.h"
+#include "ace/pre.h"
#include "tao/IOR_Parser.h"
@@ -22,13 +22,14 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "tao/Profile.h"
#include "ace/Service_Config.h"
#include "ace/Array.h"
+#include "tao/Profile.h"
#include "ace/SString.h"
class TAO_MProfile;
+
/**
* @class TAO_CORBALOC_Parser
*
@@ -83,8 +84,8 @@ private:
ACE_THROW_SPEC ((CORBA::SystemException));
struct parsed_endpoint {
- parsed_endpoint () : profile_ (0) {}
- ~parsed_endpoint () { delete this->profile_; }
+ parsed_endpoint ();
+ ~parsed_endpoint ();
TAO_Profile *profile_;
char obj_key_sep_;
ACE_CString prot_addr_;
@@ -98,5 +99,5 @@ private:
ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_CORBALOC_Parser)
ACE_FACTORY_DECLARE (TAO, TAO_CORBALOC_Parser)
-#include /**/ "ace/post.h"
+#include "ace/post.h"
#endif /* TAO_CORBALOC_PARSER_H */
diff --git a/TAO/tao/CORBALOC_Parser.i b/TAO/tao/CORBALOC_Parser.i
index 679b6208536..fddafd15c3f 100644
--- a/TAO/tao/CORBALOC_Parser.i
+++ b/TAO/tao/CORBALOC_Parser.i
@@ -1,6 +1,20 @@
+// -*- C++ -*-
// $Id$
ACE_INLINE
TAO_CORBALOC_Parser::TAO_CORBALOC_Parser (void)
{
}
+
+ACE_INLINE
+TAO_CORBALOC_Parser::parsed_endpoint::parsed_endpoint(void)
+ : profile_ (0)
+{
+}
+
+ACE_INLINE
+TAO_CORBALOC_Parser::parsed_endpoint::~parsed_endpoint (void)
+{
+ if (this->profile_ != 0)
+ this->profile_->_decr_refcnt();
+}