[asterisk-commits] kmoore: trunk r383377 - /trunk/main/stasis_message_router.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 19 14:07:47 CDT 2013


Author: kmoore
Date: Tue Mar 19 14:07:46 2013
New Revision: 383377

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383377
Log:
Fix lock destruction/unlock inversion

When using scoped locks, the unref of an AO2 object should happen after
the unlock occurs which requires usage of scoped refs.

Modified:
    trunk/main/stasis_message_router.c

Modified: trunk/main/stasis_message_router.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stasis_message_router.c?view=diff&rev=383377&r1=383376&r2=383377
==============================================================================
--- trunk/main/stasis_message_router.c (original)
+++ trunk/main/stasis_message_router.c Tue Mar 19 14:07:46 2013
@@ -91,6 +91,7 @@
 			    struct stasis_message *message)
 {
 	struct stasis_message_router *router = data;
+	RAII_VAR(struct stasis_message_router *, router_needs_cleanup, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message_route *, route, NULL, ao2_cleanup);
 	struct stasis_message_type *type = stasis_message_type(message);
 	size_t i;
@@ -123,7 +124,7 @@
 	}
 
 	if (stasis_subscription_final_message(sub, message)) {
-		ao2_cleanup(router);
+		router_needs_cleanup = router;
 		return;
 	}
 




More information about the asterisk-commits mailing list