aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-04 22:44:15 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-04 22:44:15 +0000
commit28ee0af707a994129ce8cb8571f0c1349c616741 (patch)
treefc59b8a058be1a703a368afab7168f414d12caf3 /apps
parent3dbe39533d1683f751854d46ad50d2c8ad63ba88 (diff)
fix memory leak and unload problems (issue #5380)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6719 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_directory.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 0c616b9f4..c7d2a8bf0 100755
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -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);