Avoid a deadlock when installing a trap policy failed

This commit is contained in:
Tobias Brunner
2013-01-23 15:51:47 +01:00
parent 8d631ebabd
commit 4eb09d14e2
+5 -1
View File
@@ -170,8 +170,8 @@ METHOD(trap_manager_t, install, u_int32_t,
if (status != SUCCESS) if (status != SUCCESS)
{ {
DBG1(DBG_CFG, "installing trap failed"); DBG1(DBG_CFG, "installing trap failed");
child_sa->destroy(child_sa);
reqid = 0; reqid = 0;
/* hold off destroying the CHILD_SA until we released the lock */
} }
else else
{ {
@@ -184,6 +184,10 @@ METHOD(trap_manager_t, install, u_int32_t,
} }
this->lock->unlock(this->lock); this->lock->unlock(this->lock);
if (status != SUCCESS)
{
child_sa->destroy(child_sa);
}
if (found) if (found)
{ {
destroy_entry(found); destroy_entry(found);