* tests/glr-regression.at

(Improper handling of embedded actions and dollar(-N) in GLR parsers):
Close memory leak reported by twlevo.
This commit is contained in:
Paul Eggert
2005-12-08 06:52:43 +00:00
parent 6ff9971122
commit f5228370c5
2 changed files with 12 additions and 4 deletions

View File

@@ -1,3 +1,9 @@
2005-12-07 Paul Eggert <eggert@cs.ucla.edu>
* tests/glr-regression.at
(Improper handling of embedded actions and dollar(-N) in GLR parsers):
Close memory leak reported by twlevo.
2005-12-06 "Joel E. Denny" <jdenny@ces.clemson.edu>
* data/glr.c (yyprocessOneStack, yyparse): Synchronize the shift for

View File

@@ -120,7 +120,7 @@ AT_DATA_GRAMMAR([glr-regr2a.y],
/* Reported by S. Eken */
%{
#define YYSTYPE char const *
#define YYSTYPE char *
#include <ctype.h>
#include <stdio.h>
@@ -138,9 +138,11 @@ command:
's' var 't'
{ printf ("Variable: '%s'\n", $2); }
'v' 'x' 'q'
{ free ($2); }
| 's' var_list 't' 'e'
{ printf ("Varlist: '%s'\n", $2); }
{ printf ("Varlist: '%s'\n", $2); free ($2); }
| 's' var 't' var_printer 'x'
{ free ($2); }
;
var:
@@ -153,10 +155,10 @@ var_list:
{ $$ = $1; }
| var ',' var_list
{
char *s = (char *) malloc (strlen ($1) + 1 + strlen ($3) + 1);
strcpy (s, $1);
char *s = (char *) realloc ($1, strlen ($1) + 1 + strlen ($3) + 1);
strcat (s, ",");
strcat (s, $3);
free ($3);
$$ = s;
}
;