Skip to content
Snippets Groups Projects
Commit e3386829 authored by Kevin P. Fleming's avatar Kevin P. Fleming
Browse files

fix memory leak and unload problems (issue #5380)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent b1a61a96
No related branches found
No related tags found
No related merge requests found
......@@ -411,11 +411,10 @@ static int directory_exec(struct ast_channel *chan, void *data)
char *context, *dialcontext, *dirintro, *options;
if (!data) {
ast_log(LOG_WARNING, "directory requires an argument (context[,dialcontext])\n");
ast_log(LOG_WARNING, "Directory requires an argument (context[,dialcontext])\n");
return -1;
}
top:
context = ast_strdupa(data);
dialcontext = strchr(context, '|');
if (dialcontext) {
......@@ -446,24 +445,29 @@ top:
else
dirintro = "dir-intro-fn";
}
if (chan->_state != AST_STATE_UP)
res = ast_answer(chan);
if (!res)
res = ast_streamfile(chan, dirintro, chan->language);
if (!res)
res = ast_waitstream(chan, AST_DIGIT_ANY);
ast_stopstream(chan);
if (!res)
res = ast_waitfordigit(chan, 5000);
if (res > 0) {
res = do_directory(chan, cfg, context, dialcontext, res, last);
if (res > 0) {
for (;;) {
if (!res)
res = ast_streamfile(chan, dirintro, chan->language);
if (!res)
res = ast_waitstream(chan, AST_DIGIT_ANY);
ast_stopstream(chan);
if (res >= 0) {
goto top;
ast_stopstream(chan);
if (!res)
res = ast_waitfordigit(chan, 5000);
if (res > 0) {
res = do_directory(chan, cfg, context, dialcontext, res, last);
if (res > 0) {
res = ast_waitstream(chan, AST_DIGIT_ANY);
ast_stopstream(chan);
if (res >= 0) {
continue;
}
}
}
break;
}
ast_config_destroy(cfg);
LOCAL_USER_REMOVE(u);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment