1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

M #-: Fix minor mem-leaks and valgring issues (#927)

This commit is contained in:
Pavel Czerný 2021-03-08 18:00:39 +01:00 committed by GitHub
parent d8e7464dc4
commit 5c11bf9e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 27 additions and 9 deletions

View File

@ -418,7 +418,15 @@ protected:
* Base constructor it cannot be called directly but from the
* AddressRange factory constructor.
*/
AddressRange(unsigned int _id):id(_id){};
AddressRange(unsigned int _id)
: id(_id)
, size(0)
, ip(0)
, mac{}
, global6{}
, ula6{}
, ip6{}
{}
/* ---------------------------------------------------------------------- */
/* Address/AR helper functions to build/parse driver messages */

View File

@ -190,7 +190,7 @@ private:
int rc = response.parse_str_or_xml(*msg, error);
free(msg);
delete msg;
return rc;
}

View File

@ -296,8 +296,8 @@ protected:
string method_name;
// Configuration for authentication level of the API call
PoolObjectSQL::ObjectType auth_object;
AuthRequest::Operation auth_op;
PoolObjectSQL::ObjectType auth_object = PoolObjectSQL::ObjectType::NONE;
AuthRequest::Operation auth_op = AuthRequest::Operation::NONE;
VMActions::Action vm_action;

View File

@ -58,6 +58,7 @@ error_name:
error_str = oss.str();
error_common:
delete tmpl;
oid = -1;
return oid;

View File

@ -801,10 +801,10 @@ void HostShareNUMA::set_monitorization(Template &ht, unsigned int _vt)
for (auto it = pages.begin(); it != pages.end(); ++it)
{
unsigned int pages;
unsigned int free;
unsigned int pages = 0;
unsigned int free = 0;
unsigned long size;
unsigned long size = 0;
if ( (*it)->vector_value("NODE_ID", node_id) == -1 )
{

View File

@ -138,6 +138,8 @@ void MadManager::stop()
delete mads[i];
}
mads.clear();
unlock();
}

View File

@ -127,6 +127,8 @@ int PoolSQL::allocate(PoolObjectSQL *objsql, string& error_str)
{
unlock();
delete objsql;
return -1;
}
@ -274,7 +276,7 @@ PoolObjectSQL * PoolSQL::get_ro(const string& name, int uid)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int PoolSQL::dump(string& oss, const string& elem_name, const string& column,
int PoolSQL::dump(string& oss, const string& elem_name, const string& column,
const char* table, const string& where, int sid, int eid, bool desc)
{
ostringstream cmd;

View File

@ -1386,6 +1386,8 @@ Request::ErrorCode HookAllocate::pool_allocate(
oss << "Invalid Hook type: " << hk_type;
att.resp_msg = oss.str();
delete tmpl;
return Request::INTERNAL;
}

View File

@ -529,6 +529,7 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
if (vm_authorization(id, 0, 0, att, 0, 0, 0) == false)
{
vm->unlock();
return;
}

View File

@ -1131,6 +1131,8 @@ void VirtualMachinePool::delete_attach_nic(int vid)
tmpl.set(nic->vector_attribute());
delete nic;
Quotas::quota_del(Quotas::NETWORK, uid, gid, &tmpl);
}

View File

@ -1520,7 +1520,7 @@ int AddressRange::free_addr(PoolObjectSQL::ObjectType ot, int obid,
const string& mac_s)
{
string error_msg;
unsigned int mac_i[2];
unsigned int mac_i[2] = {};
mac_to_i(mac_s, mac_i);