Handle initiation of not supported IKE versions properly
[strongswan.git] / src / libcharon / sa / ikev2 / tasks / ike_reauth.c
index d9f3fe8..8371b8b 100644 (file)
@@ -54,7 +54,6 @@ METHOD(task_t, process_i, status_t,
        ike_sa_t *new;
        host_t *host;
        enumerator_t *enumerator;
-       ike_version_t version;
        child_sa_t *child_sa;
        peer_cfg_t *peer_cfg;
 
@@ -75,9 +74,12 @@ METHOD(task_t, process_i, status_t,
                return FAILED;
        }
 
-       version = this->ike_sa->get_version(this->ike_sa);
-       new = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager, version,
-                                                                                          TRUE);
+       new = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
+                                                               this->ike_sa->get_version(this->ike_sa), TRUE);
+       if (!new)
+       {       /* shouldn't happen */
+               return FAILED;
+       }
 
        new->set_peer_cfg(new, peer_cfg);
        host = this->ike_sa->get_other_host(this->ike_sa);