Remove queued IKEv1 message before processing it
authorMartin Willi <martin@revosec.ch>
Wed, 8 Aug 2012 12:54:03 +0000 (14:54 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 8 Aug 2012 12:54:03 +0000 (14:54 +0200)
Avoids destruction or processing of a queued message in
recursive process_message() call.

src/libcharon/sa/ikev1/task_manager_v1.c

index d71f540..3c84b51 100644 (file)
@@ -962,6 +962,7 @@ static status_t process_response(private_task_manager_t *this,
                                                                 message_t *message)
 {
        enumerator_t *enumerator;
+       message_t *queued;
        status_t status;
        task_t *task;
 
@@ -1010,10 +1011,11 @@ static status_t process_response(private_task_manager_t *this,
 
        if (this->queued && this->active_tasks->get_count(this->active_tasks) == 0)
        {
-               status = this->public.task_manager.process_message(
-                                                                       &this->public.task_manager, this->queued);
-               this->queued->destroy(this->queued);
+               queued = this->queued;
                this->queued = NULL;
+               status = this->public.task_manager.process_message(
+                                                                                       &this->public.task_manager, queued);
+               queued->destroy(queued);
                if (status == DESTROY_ME)
                {
                        return status;