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

bug #4662: Do not try to unlock non locked mutex for PoolObjectSQL class

This commit is contained in:
Ruben S. Montero 2016-07-27 17:56:30 +02:00
parent 27c278b595
commit 979c506bec

View File

@ -126,8 +126,6 @@ int PoolSQL::allocate(
do_hooks(objsql, Hook::ALLOCATE);
}
objsql->unlock();
delete objsql;
if( rc != -1 )
@ -219,6 +217,8 @@ PoolObjectSQL * PoolSQL::get(
if ( rc != 0 )
{
objectsql->lock();
delete objectsql;
unlock();
@ -237,13 +237,14 @@ PoolObjectSQL * PoolSQL::get(
if ( name_index != name_pool.end() )
{
name_index->second->lock();
PoolObjectSQL * tmp_ptr = name_index->second;
name_pool.erase(okey);
pool.erase(tmp_ptr->oid);
tmp_ptr->lock();
delete tmp_ptr;
}
@ -323,14 +324,14 @@ PoolObjectSQL * PoolSQL::get(const string& name, int ouid, bool olock)
{
if ( index != name_pool.end() && index->second->isValid() == false )
{
index->second->lock();
PoolObjectSQL * tmp_ptr = index->second;
string tmp_okey = key(tmp_ptr->name,tmp_ptr->uid);
pool.erase(tmp_ptr->oid);
name_pool.erase(tmp_okey);
tmp_ptr->lock();
delete tmp_ptr;
}
@ -340,6 +341,8 @@ PoolObjectSQL * PoolSQL::get(const string& name, int ouid, bool olock)
if ( rc != 0 )
{
objectsql->lock();
delete objectsql;
unlock();
@ -456,6 +459,7 @@ void PoolSQL::replace()
delete tmp_ptr;
oid_queue.pop();
removed = true;
}
}