Index: channels/chan_local.c =================================================================== --- channels/chan_local.c (revision 300344) +++ channels/chan_local.c (working copy) @@ -778,7 +778,6 @@ ast_clear_flag(p, LOCAL_LAUNCHED_PBX); ast_module_user_remove(p->u_chan); } else { - ast_module_user_remove(p->u_owner); while (p->chan && ast_channel_trylock(p->chan)) { ao2_unlock(p); if (p->owner) { @@ -806,6 +805,7 @@ return 0; } p->owner = NULL; + ast_module_user_remove(p->u_owner); } ast->tech_pvt = NULL;