- LEAK_DETECTIVE activated
authorJan Hutter <jhutter@hsr.ch>
Tue, 8 Nov 2005 07:04:15 +0000 (07:04 -0000)
committerJan Hutter <jhutter@hsr.ch>
Tue, 8 Nov 2005 07:04:15 +0000 (07:04 -0000)
- memory leak in event_queue_t fixed

Source/charon/event_queue.c
Source/charon/tests/event_queue_test.c
Source/charon/tests/job_queue_test.c
Source/charon/tests/sender_test.c

index 132e489..243186c 100644 (file)
@@ -280,6 +280,7 @@ static status_t add_absolute(private_event_queue_t *this, job_t *job, timeval_t
                status = iterator->has_next(iterator,&has_next);
                if (status != SUCCESS)
                {
                status = iterator->has_next(iterator,&has_next);
                if (status != SUCCESS)
                {
+                       iterator->destroy(iterator);
                        break;
                }
                
                        break;
                }
                
@@ -295,8 +296,7 @@ static status_t add_absolute(private_event_queue_t *this, job_t *job, timeval_t
                        if (time_difference(&(event->time), &(current_event->time)) <= 0)
                        {
                                /* my event has to be fired before the current event in list */
                        if (time_difference(&(event->time), &(current_event->time)) <= 0)
                        {
                                /* my event has to be fired before the current event in list */
-                               status = this->list->insert_before(this->list,current_list_element,event);
-                               
+                               status = this->list->insert_before(this->list,current_list_element,event);                              
                                break;
                        }
                        
                                break;
                        }
                        
@@ -306,6 +306,7 @@ static status_t add_absolute(private_event_queue_t *this, job_t *job, timeval_t
                                break;
                        }
                }
                                break;
                        }
                }
+               iterator->destroy(iterator);
                break;
        }
 
                break;
        }
 
index 2cad71c..b06b16b 100644 (file)
@@ -30,7 +30,7 @@
 /**
  * Number of different times to insert per thread
  */
 /**
  * Number of different times to insert per thread
  */
-#define EVENT_QUEUE_TIMES 10
+#define EVENT_QUEUE_TIMES 5
 /**
  * Number of entries per time per thread
  */
 /**
  * Number of entries per time per thread
  */
index 1fd3357..b381133 100644 (file)
@@ -104,7 +104,7 @@ void test_job_queue(tester_t *tester)
        test_infos.tester = tester;
        test_infos.job_queue = job_queue;
        test_infos.insert_item_count = 10000;
        test_infos.tester = tester;
        test_infos.job_queue = job_queue;
        test_infos.insert_item_count = 10000;
-       test_infos.remove_item_count = 10000;
+       test_infos.remove_item_count = 50000;
        
        
        desired_value = test_infos.insert_item_count * sender_count - 
        
        
        desired_value = test_infos.insert_item_count * sender_count - 
@@ -130,9 +130,9 @@ void test_job_queue(tester_t *tester)
                pthread_join(receiver_threads[i], NULL);
        }
        
                pthread_join(receiver_threads[i], NULL);
        }
        
-       
        /* the job-queue has to have disered_value count entries! */
        tester->assert_true(tester,(job_queue->get_count(job_queue,&value) == SUCCESS), "get count call check");
        /* the job-queue has to have disered_value count entries! */
        tester->assert_true(tester,(job_queue->get_count(job_queue,&value) == SUCCESS), "get count call check");
-       tester->assert_true(tester,(value == desired_value), "get count value check");
+       tester->assert_true(tester,(value == desired_value), "get count value check");  
+       
        tester->assert_true(tester,(job_queue->destroy(job_queue) == SUCCESS), "destroy call check");
 }
        tester->assert_true(tester,(job_queue->destroy(job_queue) == SUCCESS), "destroy call check");
 }
index 580320b..f0e3820 100644 (file)
@@ -33,7 +33,7 @@
 /**
  * Number of packets to send by sender-thread
  */
 /**
  * Number of packets to send by sender-thread
  */
-#define NUMBER_OF_PACKETS_TO_SEND 400
+#define NUMBER_OF_PACKETS_TO_SEND 50
 
 /**
  * Port to send the packets to
 
 /**
  * Port to send the packets to