diff options
Diffstat (limited to 'src/libcharon/sa/ikev2/tasks/ike_rekey.c')
-rw-r--r-- | src/libcharon/sa/ikev2/tasks/ike_rekey.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libcharon/sa/ikev2/tasks/ike_rekey.c b/src/libcharon/sa/ikev2/tasks/ike_rekey.c index 2cfcdc1fc..c3c6cf00e 100644 --- a/src/libcharon/sa/ikev2/tasks/ike_rekey.c +++ b/src/libcharon/sa/ikev2/tasks/ike_rekey.c @@ -123,16 +123,20 @@ METHOD(task_t, process_i_delete, status_t, METHOD(task_t, build_i, status_t, private_ike_rekey_t *this, message_t *message) { + ike_version_t version; peer_cfg_t *peer_cfg; host_t *other_host; /* create new SA only on first try */ if (this->new_sa == NULL) { - ike_version_t version = this->ike_sa->get_version(this->ike_sa); + version = this->ike_sa->get_version(this->ike_sa); this->new_sa = charon->ike_sa_manager->checkout_new( charon->ike_sa_manager, version, TRUE); - + if (!this->new_sa) + { /* shouldn't happen */ + return FAILED; + } peer_cfg = this->ike_sa->get_peer_cfg(this->ike_sa); other_host = this->ike_sa->get_other_host(this->ike_sa); this->new_sa->set_peer_cfg(this->new_sa, peer_cfg); @@ -149,7 +153,6 @@ METHOD(task_t, process_r, status_t, private_ike_rekey_t *this, message_t *message) { enumerator_t *enumerator; - ike_version_t version; peer_cfg_t *peer_cfg; child_sa_t *child_sa; @@ -177,9 +180,12 @@ METHOD(task_t, process_r, status_t, } enumerator->destroy(enumerator); - version = this->ike_sa->get_version(this->ike_sa); this->new_sa = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager, - version, FALSE); + this->ike_sa->get_version(this->ike_sa), FALSE); + if (!this->new_sa) + { /* shouldn't happen */ + return FAILED; + } peer_cfg = this->ike_sa->get_peer_cfg(this->ike_sa); this->new_sa->set_peer_cfg(this->new_sa, peer_cfg); |