summaryrefslogtreecommitdiff
path: root/main/threadpool.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2016-07-13 12:30:58 -0400
committerCorey Farrell <git@cfware.com>2016-07-13 11:47:56 -0500
commitfd54d69feb806bc4052ca7270b4598a805d8975f (patch)
tree5930a849fbc98beea8b3bde3e0caff402a8066c0 /main/threadpool.c
parent73d8cb587d6515b707c9cafe334e18fbd7c24905 (diff)
threadpool: Fix leak in ast_threadpool_serializer_group error path.
ast_threadpool_serializer_group leaks a reference to ser when listener is allocated but tps is not. Although listener takes the reference to ser cleanup functions are not run without tps. ASTERISK-26191 #close Change-Id: Ie3ccf69a3f1e676c2ef62a77067c0cb57dc9a585
Diffstat (limited to 'main/threadpool.c')
-rw-r--r--main/threadpool.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/threadpool.c b/main/threadpool.c
index 9cd33ab1a..6240b7329 100644
--- a/main/threadpool.c
+++ b/main/threadpool.c
@@ -1384,10 +1384,12 @@ struct ast_taskprocessor *ast_threadpool_serializer_group(const char *name,
ao2_ref(ser, -1);
return NULL;
}
- /* ser ref transferred to listener */
tps = ast_taskprocessor_create_with_listener(name, listener);
- if (tps && shutdown_group) {
+ if (!tps) {
+ /* ser ref transferred to listener but not cleaned without tps */
+ ao2_ref(ser, -1);
+ } else if (shutdown_group) {
serializer_shutdown_group_inc(shutdown_group);
}