aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon
diff options
context:
space:
mode:
authorJan Hutter <jhutter@hsr.ch>2005-11-22 11:53:26 +0000
committerJan Hutter <jhutter@hsr.ch>2005-11-22 11:53:26 +0000
commit83cad34b9475c40c4c3309a47aaad01350ffaa65 (patch)
treef6fb4d091e3a04f5ed7a86061e9524d826c12906 /Source/charon
parent4502839210a36b641c03a10539324e08b822b1e5 (diff)
downloadstrongswan-83cad34b9475c40c4c3309a47aaad01350ffaa65.tar.bz2
strongswan-83cad34b9475c40c4c3309a47aaad01350ffaa65.tar.xz
- fixed segmentation fault when destroying ike_sa entries
Diffstat (limited to 'Source/charon')
-rw-r--r--Source/charon/ike_sa_manager.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/Source/charon/ike_sa_manager.c b/Source/charon/ike_sa_manager.c
index 2a9414d24..107b38da7 100644
--- a/Source/charon/ike_sa_manager.c
+++ b/Source/charon/ike_sa_manager.c
@@ -686,6 +686,7 @@ static status_t destroy(private_ike_sa_manager_t *this)
linked_list_t *list = this->ike_sa_list;
linked_list_iterator_t *iterator;
status_t status;
+ ike_sa_entry_t *entry;
pthread_mutex_lock(&(this->mutex));
@@ -703,7 +704,6 @@ static status_t destroy(private_ike_sa_manager_t *this)
this->logger->log(this->logger,CONTROL | MOST,"Set driveout flags for all stored IKE_SA's");
while (iterator->has_next(iterator))
{
- ike_sa_entry_t *entry;
iterator->current(iterator, (void**)&entry);
/* do not accept new threads, drive out waiting threads */
entry->driveout_new_threads = TRUE;
@@ -715,7 +715,6 @@ static status_t destroy(private_ike_sa_manager_t *this)
iterator->reset(iterator);
while (iterator->has_next(iterator))
{
- ike_sa_entry_t *entry;
iterator->current(iterator, (void**)&entry);
while (entry->waiting_threads)
{
@@ -727,15 +726,15 @@ static status_t destroy(private_ike_sa_manager_t *this)
}
this->logger->log(this->logger,CONTROL | MOST,"Delete all IKE_SA's");
/* Step 3: delete all entries */
- iterator->reset(iterator);
- while (iterator->has_next(iterator))
+ iterator->destroy(iterator);
+
+ while (list->get_count(list) > 0)
{
- ike_sa_entry_t *entry;
- iterator->current(iterator, (void**)&entry);
+ list->get_first(list, (void**)&entry);
this->delete_entry(this, entry);
}
- iterator->destroy(iterator);
list->destroy(list);
+ this->logger->log(this->logger,CONTROL | MOST,"IKE_SA's deleted");
pthread_mutex_unlock(&(this->mutex));
/* destroy logger at end */