diff --git a/src/acl/AclManager.cc b/src/acl/AclManager.cc index 0818657ce7..91468c5962 100644 --- a/src/acl/AclManager.cc +++ b/src/acl/AclManager.cc @@ -790,7 +790,7 @@ int AclManager::del_rule( { lock(); - AclRule * rule = new AclRule(-1, user, resource, rights, zone); + AclRule rule(-1, user, resource, rights, zone); int oid = -1; bool found = false; @@ -803,7 +803,7 @@ int AclManager::del_rule( for ( it = index.first; (it != index.second && !found); it++) { - found = *(it->second) == *rule; + found = *(it->second) == rule; if (found) { diff --git a/src/host/HostShareNUMA.cc b/src/host/HostShareNUMA.cc index 31278cd76c..9122691c4d 100644 --- a/src/host/HostShareNUMA.cc +++ b/src/host/HostShareNUMA.cc @@ -775,7 +775,7 @@ void HostShareNUMA::set_monitorization(Template &ht, unsigned int _vt) std::vector cores; - ht.remove("CORE", cores); + ht.get("CORE", cores); for (auto it = cores.begin(); it != cores.end(); ++it) { @@ -797,7 +797,7 @@ void HostShareNUMA::set_monitorization(Template &ht, unsigned int _vt) std::vector pages; - ht.remove("HUGEPAGE", pages); + ht.get("HUGEPAGE", pages); for (auto it = pages.begin(); it != pages.end(); ++it) { @@ -822,7 +822,7 @@ void HostShareNUMA::set_monitorization(Template &ht, unsigned int _vt) std::vector memory; - ht.remove("MEMORY_NODE", memory); + ht.get("MEMORY_NODE", memory); for (auto it = memory.begin(); it != memory.end(); ++it) { diff --git a/src/market/MarketPlace.cc b/src/market/MarketPlace.cc index 59d6cf99b2..5970cdec0a 100644 --- a/src/market/MarketPlace.cc +++ b/src/market/MarketPlace.cc @@ -221,11 +221,11 @@ int MarketPlace::insert_replace(SqlDB *db, bool replace, string& error_str) << other_u << ")"; } - rc = db->exec_wr(oss); - db->free_str(sql_name); db->free_str(sql_xml); + rc = db->exec_wr(oss); + return rc; error_xml: diff --git a/src/market/MarketPlaceApp.cc b/src/market/MarketPlaceApp.cc index d455ef6202..79826111b5 100644 --- a/src/market/MarketPlaceApp.cc +++ b/src/market/MarketPlaceApp.cc @@ -197,11 +197,11 @@ int MarketPlaceApp::insert_replace(SqlDB *db, bool replace, string& error_str) << other_u << ")"; } - rc = db->exec_wr(oss); - db->free_str(sql_name); db->free_str(sql_xml); + rc = db->exec_wr(oss); + return rc; error_xml: diff --git a/src/market/MarketPlaceAppPool.cc b/src/market/MarketPlaceAppPool.cc index 8333e19fc2..0d336132a3 100644 --- a/src/market/MarketPlaceAppPool.cc +++ b/src/market/MarketPlaceAppPool.cc @@ -221,6 +221,9 @@ int MarketPlaceAppPool::import(const std::string& t64, int mp_id, if ( !PoolObjectSQL::name_is_valid(app->name, error_str) ) { error_str = "Cannot generate a valida name for app"; + + delete app; + return -1; } } diff --git a/src/rm/RequestManager.cc b/src/rm/RequestManager.cc index 1ad02bd241..bb64402b53 100644 --- a/src/rm/RequestManager.cc +++ b/src/rm/RequestManager.cc @@ -184,7 +184,7 @@ extern "C" void * rm_xml_server_loop(void *arg) // ------------------------------------------------------------------------- // Main connection loop // ------------------------------------------------------------------------- - ConnectionManager *cm =new ConnectionManager(rm, rm->max_conn); + std::unique_ptr cm{new ConnectionManager(rm, rm->max_conn)}; while (true) { @@ -205,13 +205,11 @@ extern "C" void * rm_xml_server_loop(void *arg) NebulaLog::log("ReM", Log::DDEBUG, oss); - Connection * rc = new Connection(client_fd, cm); + Connection * rc = new Connection(client_fd, cm.get()); pthread_create(&thread_id, &pattr, rm_do_connection, (void *) rc); } - delete cm; - return 0; } diff --git a/src/rm/RequestManagerVirtualNetwork.cc b/src/rm/RequestManagerVirtualNetwork.cc index 49147ea03a..aac09e9424 100644 --- a/src/rm/RequestManagerVirtualNetwork.cc +++ b/src/rm/RequestManagerVirtualNetwork.cc @@ -362,6 +362,8 @@ void VirtualNetworkReserve::request_execute( att.resp_msg = ar.message; failure_response(AUTHORIZATION, att); + delete vtmpl; + return; } diff --git a/src/rm/RequestManagerVirtualRouter.cc b/src/rm/RequestManagerVirtualRouter.cc index 288bc24fb2..fac64aa5db 100644 --- a/src/rm/RequestManagerVirtualRouter.cc +++ b/src/rm/RequestManagerVirtualRouter.cc @@ -58,7 +58,6 @@ void VirtualRouterInstantiate::request_execute( VMTemplatePool* tpool = nd.get_tpool(); PoolObjectAuth vr_perms; - Template* extra_attrs; string error; string vr_name, tmp_name; ostringstream oss; @@ -82,7 +81,7 @@ void VirtualRouterInstantiate::request_execute( vr->get_permissions(vr_perms); - extra_attrs = vr->get_vm_template(); + std::unique_ptr