[asterisk-commits] threadpool: Fix leak in ast threadpool serializer group erro... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 14 13:33:52 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: threadpool: Fix leak in ast_threadpool_serializer_group error path.
......................................................................


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
---
M main/threadpool.c
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/main/threadpool.c b/main/threadpool.c
index 9cd33ab..6240b73 100644
--- a/main/threadpool.c
+++ b/main/threadpool.c
@@ -1384,10 +1384,12 @@
 		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);
 	}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie3ccf69a3f1e676c2ef62a77067c0cb57dc9a585
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list