Avoid relocking while enumerator is alive
This commit is contained in:
parent
f395f28e44
commit
380106ab0d
|
@ -168,20 +168,21 @@ static bool encode(private_key_encoding_t *this, key_encoding_type_t type,
|
||||||
va_end(copy);
|
va_end(copy);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
if (cache)
|
|
||||||
{
|
|
||||||
chunk = malloc_thing(chunk_t);
|
|
||||||
*chunk = *encoding;
|
|
||||||
this->lock->unlock(this->lock);
|
|
||||||
this->lock->write_lock(this->lock);
|
|
||||||
this->cache[type]->put(this->cache[type], cache, chunk);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
va_end(args);
|
|
||||||
this->lock->unlock(this->lock);
|
this->lock->unlock(this->lock);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
if (success && cache)
|
||||||
|
{
|
||||||
|
chunk = malloc_thing(chunk_t);
|
||||||
|
*chunk = *encoding;
|
||||||
|
this->lock->write_lock(this->lock);
|
||||||
|
this->cache[type]->put(this->cache[type], cache, chunk);
|
||||||
|
this->lock->unlock(this->lock);
|
||||||
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue