free unneeded retransmission packet when exchange completes
authorMartin Willi <martin@strongswan.org>
Mon, 9 Feb 2009 10:45:51 +0000 (10:45 -0000)
committerMartin Willi <martin@strongswan.org>
Mon, 9 Feb 2009 10:45:51 +0000 (10:45 -0000)
src/charon/sa/task_manager.c

index 211e64f..7258de5 100644 (file)
@@ -445,7 +445,6 @@ static status_t build_request(private_task_manager_t *this)
        /* update exchange type if a task changed it */
        this->initiating.type = message->get_exchange_type(message);
        
-       DESTROY_IF(this->initiating.packet);
        status = this->ike_sa->generate_message(this->ike_sa, message,
                                                                                        &this->initiating.packet);
        if (status != SUCCESS)
@@ -514,6 +513,8 @@ static status_t process_response(private_task_manager_t *this,
        
        this->initiating.mid++;
        this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
+       this->initiating.packet->destroy(this->initiating.packet);
+       this->initiating.packet = NULL;
        
        return build_request(this);
 }