From: Kinsey Moore Date: Tue, 19 Mar 2013 19:07:46 +0000 (+0000) Subject: Fix lock destruction/unlock inversion X-Git-Tag: 13.0.0-beta1~2000 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6aee9178d59d0cb51319fb3662872f478fe6b4e5;p=thirdparty%2Fasterisk.git 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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383377 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/stasis_message_router.c b/main/stasis_message_router.c index 01ad88ae07..97ed7ad92c 100644 --- a/main/stasis_message_router.c +++ b/main/stasis_message_router.c @@ -91,6 +91,7 @@ static void router_dispatch(void *data, 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 @@ static void router_dispatch(void *data, } if (stasis_subscription_final_message(sub, message)) { - ao2_cleanup(router); + router_needs_cleanup = router; return; }