[Asterisk-cvs] asterisk/apps app_directory.c,1.44,1.45

kpfleming kpfleming
Tue Oct 4 18:48:27 CDT 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv1467/apps

Modified Files:
	app_directory.c 
Log Message:
fix memory leak and unload problems (issue #5380)


Index: app_directory.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_directory.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- app_directory.c	15 Sep 2005 01:31:49 -0000	1.44
+++ app_directory.c	4 Oct 2005 22:44:15 -0000	1.45
@@ -411,11 +411,10 @@
 	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 @@
 		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);




More information about the svn-commits mailing list