diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c index 791851f08b8c5e6bd0d47f31d754daeb50227369..4e5e5244953de20e2b5f6523a89c642eab530ea5 100755 --- a/apps/app_chanisavail.c +++ b/apps/app_chanisavail.c @@ -101,6 +101,7 @@ static int chanavail_exec(struct ast_channel *chan, void *data) number = strchr(tech, '/'); if (!number) { ast_log(LOG_WARNING, "ChanIsAvail argument takes format ([technology]/[device])\n"); + LOCAL_USER_REMOVE(u); return -1; } *number = '\0'; @@ -135,8 +136,10 @@ static int chanavail_exec(struct ast_channel *chan, void *data) if (res < 1) { pbx_builtin_setvar_helper(chan, "AVAILCHAN", ""); pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", ""); - if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) + if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) { + LOCAL_USER_REMOVE(u); return -1; + } } LOCAL_USER_REMOVE(u);