[asterisk-commits] mmichelson: branch mmichelson/taskprocessor_memleak r378203 - /team/mmichelso...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 24 12:30:32 CST 2012


Author: mmichelson
Date: Mon Dec 24 12:30:27 2012
New Revision: 378203

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378203
Log:
Convert apps directory to use new taskprocessor API.

Only one left is ccss.c since it has the highest usage
of taskprocessors.


Modified:
    team/mmichelson/taskprocessor_memleak/apps/app_queue.c
    team/mmichelson/taskprocessor_memleak/apps/app_voicemail.c

Modified: team/mmichelson/taskprocessor_memleak/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/taskprocessor_memleak/apps/app_queue.c?view=diff&rev=378203&r1=378202&r2=378203
==============================================================================
--- team/mmichelson/taskprocessor_memleak/apps/app_queue.c (original)
+++ team/mmichelson/taskprocessor_memleak/apps/app_queue.c Mon Dec 24 12:30:27 2012
@@ -1567,7 +1567,7 @@
 	}
 	sc->state = state;
 	strcpy(sc->dev, device);
-	if (ast_taskprocessor_push(devicestate_tps, handle_statechange, sc) < 0) {
+	if (ast_taskprocessor_push(devicestate_tps, handle_statechange, ast_free_ptr, sc) < 0) {
 		ast_free(sc);
 	}
 }

Modified: team/mmichelson/taskprocessor_memleak/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/taskprocessor_memleak/apps/app_voicemail.c?view=diff&rev=378203&r1=378202&r2=378203
==============================================================================
--- team/mmichelson/taskprocessor_memleak/apps/app_voicemail.c (original)
+++ team/mmichelson/taskprocessor_memleak/apps/app_voicemail.c Mon Dec 24 12:30:27 2012
@@ -11533,8 +11533,15 @@
 	if (mwi_sub)
 		mwi_sub_destroy(mwi_sub);
 
-	ast_free(uniqueid);	
 	return 0;
+}
+
+static void mwi_sub_task_destroy(void *data)
+{
+	struct mwi_sub_task *mwist = data;
+	ast_free(mwist->mailbox);
+	ast_free(mwist->context);
+	ast_free(mwist);
 }
 
 static int handle_subscribe(void *datap)
@@ -11565,9 +11572,6 @@
 	AST_RWLIST_WRLOCK(&mwi_subs);
 	AST_RWLIST_INSERT_TAIL(&mwi_subs, mwi_sub, entry);
 	AST_RWLIST_UNLOCK(&mwi_subs);
-	ast_free((void *) p->mailbox);
-	ast_free((void *) p->context);
-	ast_free(p);
 	poll_subscribed_mailbox(mwi_sub);
 	return 0;
 }
@@ -11593,7 +11597,7 @@
 
 	u = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
 	*uniqueid = u;
-	if (ast_taskprocessor_push(mwi_subscription_tps, handle_unsubscribe, uniqueid) < 0) {
+	if (ast_taskprocessor_push(mwi_subscription_tps, handle_unsubscribe, ast_free_ptr, uniqueid) < 0) {
 		ast_free(uniqueid);
 	}
 }
@@ -11616,8 +11620,8 @@
 	mwist->context = ast_strdup(ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT));
 	mwist->uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
 	
-	if (ast_taskprocessor_push(mwi_subscription_tps, handle_subscribe, mwist) < 0) {
-		ast_free(mwist);
+	if (ast_taskprocessor_push(mwi_subscription_tps, handle_subscribe, mwi_sub_task_destroy, mwist) < 0) {
+		mwi_sub_task_destroy(mwist);
 	}
 }
 




More information about the asterisk-commits mailing list