diff options
-rw-r--r-- | ACE/ChangeLog | 7 | ||||
-rw-r--r-- | ACE/tests/Timer_Queue_Reference_Counting_Test.cpp | 4 | ||||
-rw-r--r-- | ACE/tests/Timer_Queue_Test.cpp | 16 |
3 files changed, 20 insertions, 7 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index a74a28066aa..2299bad6b1e 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,10 @@ +Mon Jul 30 14:45:00 UTC 2007 Simon Massey <sma@prismtech.com> + + * tests/Timer_Queue_Reference_Counting_Test.cpp: + * tests/Timer_Queue_Test.cpp: + + Minor memory leak fixes. + Mon Jul 30 13:37:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> * configure.ac: diff --git a/ACE/tests/Timer_Queue_Reference_Counting_Test.cpp b/ACE/tests/Timer_Queue_Reference_Counting_Test.cpp index 08fbe99698a..7b36fd5f115 100644 --- a/ACE/tests/Timer_Queue_Reference_Counting_Test.cpp +++ b/ACE/tests/Timer_Queue_Reference_Counting_Test.cpp @@ -337,7 +337,7 @@ expire (ACE_Timer_Queue &timer_queue, ACE_Time_Value (1)); ACE_ASSERT (timer_id != -1); - timer_id = + result = timer_queue.schedule (handler, two_second_timeout, ACE_Time_Value (2) + timer_queue.gettimeofday ()); @@ -370,6 +370,8 @@ expire (ACE_Timer_Queue &timer_queue, i += result; } + + timer_queue.cancel (timer_id, 0, 0); } template<class TIMER_QUEUE> diff --git a/ACE/tests/Timer_Queue_Test.cpp b/ACE/tests/Timer_Queue_Test.cpp index 1a788f1fc26..2b3e87343a6 100644 --- a/ACE/tests/Timer_Queue_Test.cpp +++ b/ACE/tests/Timer_Queue_Test.cpp @@ -169,15 +169,17 @@ test_functionality (ACE_Timer_Queue *tq) tq->gettimeofday ()); ACE_ASSERT (result != -1); - ACE_NEW (timer_act, int (42)); + const void *timer_act1 = 0; + ACE_NEW (timer_act1, int (42)); result = tq->schedule (&eh, - timer_act, + timer_act1, tq->gettimeofday () + ACE_Time_Value (100)); ACE_ASSERT (result != -1); - ACE_NEW (timer_act, int (42)); + const void *timer_act2 = 0; + ACE_NEW (timer_act2, int (42)); result = tq->schedule (&eh, - timer_act, + timer_act2, tq->gettimeofday () + ACE_Time_Value (100)); ACE_ASSERT (result != -1); @@ -194,6 +196,8 @@ test_functionality (ACE_Timer_Queue *tq) ACE_ASSERT (eh.close_count_ == 2); ACE_ASSERT (tq->is_empty () != 0); + delete (int *) timer_act2; + delete (int *) timer_act1; ACE_NEW (timer_act, int (4)); timer_id = tq->schedule (&eh, @@ -252,14 +256,14 @@ test_functionality (ACE_Timer_Queue *tq) ACE_ASSERT (eh.close_count_ == 3); result = tq->cancel (timer_id, &timer_act); - delete (int *) timer_act; ACE_ASSERT (result == 1); ACE_ASSERT (eh.close_count_ == 3); + delete (int *) timer_act; result = tq->cancel (timer_id2, &timer_act); - delete (int *) timer_act; ACE_ASSERT (result == 1); ACE_ASSERT (eh.close_count_ == 3); + delete (int *) timer_act; result = tq->expire (); ACE_ASSERT (result == 0); |