On Fri, Aug 25, 2006 at 11:08:03AM +0100, Andrew Talbot wrote:
What confused me - especially with my ignorance of yacc - is that I couldn't find a corresponding xmalloc() that assigns the char * variables that the above free() frees. make_var() gains storage for a var_t type, but the free() in get_type() releases the storage of a char *. I couldn't quite follow what was going on, there. Is it because the string is the first element in the structure, so the pointer to the string also points to the start of the var_t type?
The strings are allocated in the lexer (parser.l):
yylval.str = xstrdup(kw);
The patch that was actually committed (using xstrdup) is most consistent.