From: Mika Laitio Date: Fri, 3 Aug 2012 15:46:52 +0000 (+0300) Subject: memory leak fix X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=1695778b8ea970b443dd8367f20505d6a5fb4850;p=libplpbus.git memory leak fix added call to orb->destroy() on OrbServerImpl destroctor. Signed-off-by: Mika Laitio --- diff --git a/src/plpbus/OrbServerImpl.cc b/src/plpbus/OrbServerImpl.cc index 1207f91..c22e3de 100644 --- a/src/plpbus/OrbServerImpl.cc +++ b/src/plpbus/OrbServerImpl.cc @@ -30,6 +30,7 @@ OrbServerImpl::OrbServerImpl() OrbServerImpl::~OrbServerImpl() { + _orb->destroy(); log_info("done\n"); } @@ -278,12 +279,12 @@ CosNaming::NamingContext_var OrbServerImpl::get_naming_service_context(const cha ret_val = NULL; try { // get nameservice reference - log_debug("started\n"); - ns_obj = _orb->resolve_initial_references(CONST_NAME_SERVICE_NAME); + //log_debug("started\n"); + ns_obj = _orb->resolve_initial_references("NameService"); if (CORBA::is_nil(ns_obj) == false) { // get naming service context - ns_cntx = CosNaming::NamingContext::_narrow(ns_obj); - if (CORBA::is_nil(ns_cntx) == false) { + ns_cntx = CosNaming::NamingContext::_narrow(ns_obj.in()); + if (CORBA::is_nil(ns_cntx.in()) == false) { cntx_dta.length(1); cntx_dta[0].id = CORBA::string_dup(service_name_param); cntx_dta[0].kind = CORBA::string_dup(service_kind_param); @@ -311,6 +312,7 @@ CosNaming::NamingContext_var OrbServerImpl::get_naming_service_context(const cha catch(CosNaming::NamingContext::AlreadyBound& ex) { log_error("Failed to get naming service context for %s. Context with same name already exist.\n", service_name_param); } + //CORBA::release(ns_cntx); } else { log_error("Failed to get naming service context for %s. Could not narrow the name service.\n", service_name_param); @@ -338,7 +340,7 @@ CosNaming::NamingContext_var OrbServerImpl::get_naming_service_context(const cha catch(CORBA::SystemException& ex) { log_error("Failed to get naming service context for %s, system error.\n", service_name_param); } - log_debug("done\n"); + //log_debug("done\n"); return ret_val; }