[asterisk-commits] murf: branch 1.6.0 r109397 - in /branches/1.6.0: ./ pbx/ael/ael-test/ pbx/ael...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 18 10:14:22 CDT 2008


Author: murf
Date: Tue Mar 18 10:14:22 2008
New Revision: 109397

URL: http://svn.digium.com/view/asterisk?view=rev&rev=109397
Log:
Merged revisions 109357 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r109357 | murf | 2008-03-18 08:09:50 -0600 (Tue, 18 Mar 2008) | 25 lines

Merged revisions 109309 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r109309 | murf | 2008-03-18 00:37:15 -0600 (Tue, 18 Mar 2008) | 17 lines

(closes issue #11903)
Reported by: atis

Many thanks to atis for spotting this problem and reporting it.
The fix was to straighten out how items are placed on and removed
from the file stack. Regressions as well as the provided test case
helped to straighten out all code paths. valgrind was used to make
sure all memory allocated was freed.

Sorry for not solving this earlier. I got distracted.

Added the ntest23 regression test, which is mainly a copy of ntest22, 
but with a few juicy errors thrown in, to replicate the kind of 
error that atis spotted.



........

................

Added:
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/
      - copied from r109357, trunk/pbx/ael/ael-test/ael-ntest23/
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/extensions.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/extensions.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/qq.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/qq.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t1/
      - copied from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t1/
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t1/a.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t1/a.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t1/b.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t1/b.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t1/c.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t1/c.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t2/
      - copied from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t2/
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t2/d.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t2/d.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t2/e.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t2/e.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t2/f.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t2/f.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t3/
      - copied from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t3/
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t3/g.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t3/g.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t3/h.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t3/h.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t3/i.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t3/i.ael
    branches/1.6.0/pbx/ael/ael-test/ael-ntest23/t3/j.ael
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ael-ntest23/t3/j.ael
    branches/1.6.0/pbx/ael/ael-test/ref.ael-ntest23
      - copied unchanged from r109357, trunk/pbx/ael/ael-test/ref.ael-ntest23
Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/res/ael/ael.flex
    branches/1.6.0/res/ael/ael_lex.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/res/ael/ael.flex
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/ael/ael.flex?view=diff&rev=109397&r1=109396&r2=109397
==============================================================================
--- branches/1.6.0/res/ael/ael.flex (original)
+++ branches/1.6.0/res/ael/ael.flex Tue Mar 18 10:14:22 2008
@@ -445,8 +445,6 @@
 <<EOF>>		{
 		char fnamebuf[2048];
 		if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) {
-			free(my_file);
-			my_file = 0;
 			yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner );
 			include_stack[include_stack_index-1].globbuf_pos++;
 			setup_filestack(fnamebuf, sizeof(fnamebuf), &include_stack[include_stack_index-1].globbuf, include_stack[include_stack_index-1].globbuf_pos, yyscanner, 0);
@@ -457,13 +455,13 @@
 				free(include_stack[include_stack_index].fname);
 				include_stack[include_stack_index].fname = 0;
 			}
+			if (my_file) {
+				free(my_file);
+				my_file = 0;
+			}
 			if ( --include_stack_index < 0 ) {
 				yyterminate();
 			} else {
-				if (my_file) {
-					free(my_file);
-					my_file = 0;
-				}
 				globfree(&include_stack[include_stack_index].globbuf);
 				include_stack[include_stack_index].globbuf_pos = -1;
 				
@@ -670,12 +668,16 @@
 			buffer[stats.st_size] = 0;
 			ast_log(LOG_NOTICE,"  --Read in included file %s, %d chars\n",fnamebuf2, (int)stats.st_size);
 			fclose(in1);
+			if (include_stack[include_stack_index].fname) {
+			   	free(include_stack[include_stack_index].fname);
+				include_stack[include_stack_index].fname = 0;
+			}
+			include_stack[include_stack_index].fname = strdup(my_file);
+			include_stack[include_stack_index].lineno = my_lineno;
+			include_stack[include_stack_index].colno = my_col+yyleng;
 			if (my_file)
 				free(my_file);
 			my_file = strdup(fnamebuf2);
-			include_stack[include_stack_index].fname = strdup(my_file);
-			include_stack[include_stack_index].lineno = my_lineno;
-			include_stack[include_stack_index].colno = my_col+yyleng;
 			if (create)
 				include_stack[include_stack_index].globbuf = *globbuf;
 

Modified: branches/1.6.0/res/ael/ael_lex.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/ael/ael_lex.c?view=diff&rev=109397&r1=109396&r2=109397
==============================================================================
--- branches/1.6.0/res/ael/ael_lex.c (original)
+++ branches/1.6.0/res/ael/ael_lex.c Tue Mar 18 10:14:22 2008
@@ -793,6 +793,7 @@
  * bison-locations is probably not needed.
  */
 #line 63 "ael.flex"
+#include "asterisk.h"
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include <sys/types.h>
@@ -1745,8 +1746,6 @@
 {
 		char fnamebuf[2048];
 		if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) {
-			free(my_file);
-			my_file = 0;
 			ael_yy_delete_buffer(YY_CURRENT_BUFFER,yyscanner );
 			include_stack[include_stack_index-1].globbuf_pos++;
 			setup_filestack(fnamebuf, sizeof(fnamebuf), &include_stack[include_stack_index-1].globbuf, include_stack[include_stack_index-1].globbuf_pos, yyscanner, 0);
@@ -1757,13 +1756,13 @@
 				free(include_stack[include_stack_index].fname);
 				include_stack[include_stack_index].fname = 0;
 			}
+			if (my_file) {
+				free(my_file);
+				my_file = 0;
+			}
 			if ( --include_stack_index < 0 ) {
 				yyterminate();
 			} else {
-				if (my_file) {
-					free(my_file);
-					my_file = 0;
-				}
 				globfree(&include_stack[include_stack_index].globbuf);
 				include_stack[include_stack_index].globbuf_pos = -1;
 				
@@ -3102,12 +3101,16 @@
 			buffer[stats.st_size] = 0;
 			ast_log(LOG_NOTICE,"  --Read in included file %s, %d chars\n",fnamebuf2, (int)stats.st_size);
 			fclose(in1);
+			if (include_stack[include_stack_index].fname) {
+			   	free(include_stack[include_stack_index].fname);
+				include_stack[include_stack_index].fname = 0;
+			}
+			include_stack[include_stack_index].fname = strdup(my_file);
+			include_stack[include_stack_index].lineno = my_lineno;
+			include_stack[include_stack_index].colno = my_col+yyleng;
 			if (my_file)
 				free(my_file);
 			my_file = strdup(fnamebuf2);
-			include_stack[include_stack_index].fname = strdup(my_file);
-			include_stack[include_stack_index].lineno = my_lineno;
-			include_stack[include_stack_index].colno = my_col+yyleng;
 			if (create)
 				include_stack[include_stack_index].globbuf = *globbuf;
 




More information about the asterisk-commits mailing list