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

B #4153: Fix memory leaks (#4155)

Fix minor oned leak and scheduler leaks

(cherry picked from commit 92a67d4d9c9273c21aa5a3b3b0268f785c1e66cd)
This commit is contained in:
Pavel Czerný 2020-02-04 13:31:39 +01:00 committed by Ruben S. Montero
parent 71d0d28b4d
commit b44a4c70a7
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
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

@ -418,17 +418,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;