mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 09:13:04 +00:00
* 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:
@@ -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>
|
2005-12-06 "Joel E. Denny" <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
* data/glr.c (yyprocessOneStack, yyparse): Synchronize the shift for
|
* data/glr.c (yyprocessOneStack, yyparse): Synchronize the shift for
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ AT_DATA_GRAMMAR([glr-regr2a.y],
|
|||||||
/* Reported by S. Eken */
|
/* Reported by S. Eken */
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#define YYSTYPE char const *
|
#define YYSTYPE char *
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -138,9 +138,11 @@ command:
|
|||||||
's' var 't'
|
's' var 't'
|
||||||
{ printf ("Variable: '%s'\n", $2); }
|
{ printf ("Variable: '%s'\n", $2); }
|
||||||
'v' 'x' 'q'
|
'v' 'x' 'q'
|
||||||
|
{ free ($2); }
|
||||||
| 's' var_list 't' 'e'
|
| 's' var_list 't' 'e'
|
||||||
{ printf ("Varlist: '%s'\n", $2); }
|
{ printf ("Varlist: '%s'\n", $2); free ($2); }
|
||||||
| 's' var 't' var_printer 'x'
|
| 's' var 't' var_printer 'x'
|
||||||
|
{ free ($2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
var:
|
var:
|
||||||
@@ -153,10 +155,10 @@ var_list:
|
|||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
| var ',' var_list
|
| var ',' var_list
|
||||||
{
|
{
|
||||||
char *s = (char *) malloc (strlen ($1) + 1 + strlen ($3) + 1);
|
char *s = (char *) realloc ($1, strlen ($1) + 1 + strlen ($3) + 1);
|
||||||
strcpy (s, $1);
|
|
||||||
strcat (s, ",");
|
strcat (s, ",");
|
||||||
strcat (s, $3);
|
strcat (s, $3);
|
||||||
|
free ($3);
|
||||||
$$ = s;
|
$$ = s;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user