[asterisk-commits] test threadpool: Wait for each task to complete and fix memo... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 19 19:37:16 CST 2016


Matt Jordan has submitted this change and it was merged.

Change subject: test_threadpool: Wait for each task to complete and fix memory leak.
......................................................................


test_threadpool: Wait for each task to complete and fix memory leak.

This change makes the thread_timeout_thrash unit test wait for
each task to complete. This fixes the problem where the test would
prematurely end when all threads were gone and a new one had to be
started to handle the last task. It also increases the thrasing as
it is now more likely for each task to encounter the above scenario.

This also fixes a memory leak where the data for each task was not
being freed.

ASTERISK-25611 #close

Change-Id: I5017d621a4dc911f509074c16229b86bff2fb3c6
---
M tests/test_threadpool.c
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved



diff --git a/tests/test_threadpool.c b/tests/test_threadpool.c
index 42181a2..afb981b 100644
--- a/tests/test_threadpool.c
+++ b/tests/test_threadpool.c
@@ -636,6 +636,14 @@
 		ast_mutex_unlock(&tld->lock);
 
 		ast_threadpool_push(pool, simple_task, std);
+
+		res = wait_for_completion(test, std);
+
+		ast_free(std);
+
+		if (res == AST_TEST_FAIL) {
+			goto end;
+		}
 	}
 
 	res = wait_until_thread_state(test, tld, 0, 0);

-- 
To view, visit https://gerrit.asterisk.org/2052
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5017d621a4dc911f509074c16229b86bff2fb3c6
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list