Migrate queued_tasks tasks, to avoid dangling pointers
authorThomas Egerer <thomas.egerer@secunet.com>
Tue, 29 Jun 2010 06:53:05 +0000 (08:53 +0200)
committerMartin Willi <martin@revosec.ch>
Tue, 29 Jun 2010 07:20:05 +0000 (09:20 +0200)
src/libcharon/sa/task_manager.c

index 8857186..568f31a 100644 (file)
@@ -1003,6 +1003,13 @@ METHOD(task_manager_t, reset, void,
        }
        this->initiating.type = EXCHANGE_TYPE_UNDEFINED;
 
+       /* reset queued tasks */
+       while (this->queued_tasks->remove_last(this->queued_tasks,
+                                                                                  (void**)&task) == SUCCESS)
+       {
+               task->migrate(task, this->ike_sa);
+               this->queued_tasks->insert_first(this->queued_tasks, task);
+       }
        /* reset active tasks */
        while (this->active_tasks->remove_last(this->active_tasks,
                                                                                   (void**)&task) == SUCCESS)