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
This commit is contained in:
Kinsey Moore
2013-03-19 19:07:46 +00:00
parent ed382681e5
commit 6aee9178d5

View File

@@ -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;
}