diff options
Diffstat (limited to 'res/ael')
-rw-r--r-- | res/ael/ael.flex | 20 | ||||
-rw-r--r-- | res/ael/ael_lex.c | 27 |
2 files changed, 26 insertions, 21 deletions
diff --git a/res/ael/ael.flex b/res/ael/ael.flex index 1ca6427f4..4d7790ec8 100644 --- a/res/ael/ael.flex +++ b/res/ael/ael.flex @@ -447,8 +447,6 @@ includes { STORE_POS; return KW_INCLUDES;} <<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); @@ -459,13 +457,13 @@ includes { STORE_POS; return KW_INCLUDES;} 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; @@ -672,12 +670,16 @@ static void setup_filestack(char *fnamebuf2, int fnamebuf_siz, glob_t *globbuf, 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 (my_file) - free(my_file); - my_file = strdup(fnamebuf2); + 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); if (create) include_stack[include_stack_index].globbuf = *globbuf; diff --git a/res/ael/ael_lex.c b/res/ael/ael_lex.c index 8b7436374..bc2b2bf28 100644 --- a/res/ael/ael_lex.c +++ b/res/ael/ael_lex.c @@ -793,6 +793,7 @@ static yyconst flex_int16_t yy_chk[1035] = * bison-locations is probably not needed. */ #line 63 "ael.flex" +#include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <sys/types.h> @@ -1746,8 +1747,6 @@ case YY_STATE_EOF(comment): { 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); @@ -1758,13 +1757,13 @@ case YY_STATE_EOF(comment): 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; @@ -1779,10 +1778,10 @@ case YY_STATE_EOF(comment): YY_BREAK case 63: YY_RULE_SETUP -#line 481 "ael.flex" +#line 479 "ael.flex" ECHO; YY_BREAK -#line 1786 "ael_lex.c" +#line 1784 "ael_lex.c" case YY_END_OF_BUFFER: { @@ -2907,7 +2906,7 @@ void *ael_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 481 "ael.flex" +#line 479 "ael.flex" @@ -3103,12 +3102,16 @@ static void setup_filestack(char *fnamebuf2, int fnamebuf_siz, glob_t *globbuf, 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 (my_file) - free(my_file); - my_file = strdup(fnamebuf2); + 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); if (create) include_stack[include_stack_index].globbuf = *globbuf; |