1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

B #4153: Fix memory leaks (#4155)

Fix minor oned leak and scheduler leaks
This commit is contained in:
Pavel Czerný 2020-02-04 13:31:39 +01:00 committed by GitHub
parent ed6bdac234
commit 92a67d4d9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -130,6 +130,11 @@ public:
{
delete user_template;
}
for (auto nic : nics)
{
delete nic.second;
}
}
//--------------------------------------------------------------------------

View File

@ -161,6 +161,7 @@ void VirtualMachineXML::init_attributes()
if ( !rc || net_mode != "AUTO" )
{
delete nic_template;
continue;
}

View File

@ -416,17 +416,21 @@ int VirtualMachinePool::get_vmid (const string& deploy_id)
int vmid = -1;
ostringstream oss;
auto sql_id = db->escape_str(deploy_id);
single_cb<int> cb;
cb.set_callback(&vmid);
oss << "SELECT vmid FROM " << import_table
<< " WHERE deploy_id = '" << db->escape_str(deploy_id) << "'";
<< " WHERE deploy_id = '" << sql_id << "'";
rc = db->exec_rd(oss, &cb);
cb.unset_callback();
db->free_str(sql_id);
if (rc != 0 )
{
return -1;