[strongSwan-dev] [PATCH 2/2] Avoid destruction of child_sa still referenced by rekey job
Thomas Egerer
thomas.egerer at secunet.com
Fri May 14 17:29:03 CEST 2010
---
src/libcharon/sa/ike_sa.c | 1 +
src/libcharon/sa/tasks/child_delete.c | 6 +++---
src/libcharon/sa/tasks/child_rekey.c | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/libcharon/sa/ike_sa.c b/src/libcharon/sa/ike_sa.c
index 023f074..409bb6e 100644
--- a/src/libcharon/sa/ike_sa.c
+++ b/src/libcharon/sa/ike_sa.c
@@ -1473,6 +1473,7 @@ static child_sa_t* get_child_sa(private_ike_sa_t
*this, protocol_id_t protocol,
current->get_protocol(current) == protocol)
{
found = current;
+ current->get_ref(current);
}
}
iterator->destroy(iterator);
diff --git a/src/libcharon/sa/tasks/child_delete.c
b/src/libcharon/sa/tasks/child_delete.c
index d7c6b05..9a182d7 100644
--- a/src/libcharon/sa/tasks/child_delete.c
+++ b/src/libcharon/sa/tasks/child_delete.c
@@ -295,7 +295,7 @@ static status_t build_i(private_child_delete_t
*this, message_t *message)
static status_t process_i(private_child_delete_t *this, message_t *message)
{
/* flush the list before adding new SAs */
- this->child_sas->destroy(this->child_sas);
+ this->child_sas->destroy_offset(this->child_sas, offsetof(child_sa_t,
destroy));
this->child_sas = linked_list_create();
process_payloads(this, message);
@@ -353,7 +353,7 @@ static void migrate(private_child_delete_t *this,
ike_sa_t *ike_sa)
this->check_delete_action = FALSE;
this->ike_sa = ike_sa;
- this->child_sas->destroy(this->child_sas);
+ this->child_sas->destroy_offset(this->child_sas, offsetof(child_sa_t,
destroy));
this->child_sas = linked_list_create();
}
@@ -362,7 +362,7 @@ static void migrate(private_child_delete_t *this,
ike_sa_t *ike_sa)
*/
static void destroy(private_child_delete_t *this)
{
- this->child_sas->destroy(this->child_sas);
+ this->child_sas->destroy_offset(this->child_sas, offsetof(child_sa_t,
destroy));
free(this);
}
diff --git a/src/libcharon/sa/tasks/child_rekey.c
b/src/libcharon/sa/tasks/child_rekey.c
index b5e4e84..5e1f515 100644
--- a/src/libcharon/sa/tasks/child_rekey.c
+++ b/src/libcharon/sa/tasks/child_rekey.c
@@ -389,6 +389,7 @@ static void destroy(private_child_rekey_t *this)
this->child_delete->task.destroy(&this->child_delete->task);
}
DESTROY_IF(this->collision);
+ DESTROY_IF(this->child_sa);
free(this);
}
--
1.7.0.2
More information about the Dev
mailing list