Merge branch 'mesa_7_6_branch'

This should fix the memory leaks in the assembly parser without the
regressions.

The conflicts in program_lexer.l were related to changes in returning
strings between the branches (always return IDENTIFIER vs. returing
either IDENTIFIER or USED_IDENTIFIER).

The conflicts in program_parse.y were related to two changes in master
One change prints a variable name in an error message.  The other
change adds outputVarSize to the OUTPUT_statement rule.  The cause the
position of the IDENTIFIER to change from $2 to $3.

Conflicts:
	src/mesa/shader/lex.yy.c
	src/mesa/shader/program_lexer.l
	src/mesa/shader/program_parse.tab.c
	src/mesa/shader/program_parse.y
diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y
index 5767c51..d07bf85 100644
--- a/src/mesa/shader/program_parse.y
+++ b/src/mesa/shader/program_parse.y
@@ -309,6 +309,8 @@
 	   }
 
 
+	   free($2);
+
 	   if (!valid) {
 	      const char *const err_str = (state->mode == ARB_vertex)
 		 ? "invalid ARB vertex program option"
@@ -710,12 +712,17 @@
 	}
 	| string
 	{
+	   char s;
+
 	   if (strlen($1) > 1) {
 	      yyerror(& @1, state, "invalid extended swizzle selector");
 	      YYERROR;
 	   }
 
-	   switch ($1[0]) {
+	   s = $1[0];
+	   free($1);
+
+	   switch (s) {
 	   case 'x':
 	      $$.swz = SWIZZLE_X;
 	      $$.xyzw_valid = 1;
@@ -763,6 +770,8 @@
 	   struct asm_symbol *const s = (struct asm_symbol *)
 	      _mesa_symbol_table_find_symbol(state->st, 0, $1);
 
+	   free($1);
+
 	   if (s == NULL) {
 	      yyerror(& @1, state, "invalid operand variable");
 	      YYERROR;
@@ -845,6 +854,8 @@
 	   struct asm_symbol *const s = (struct asm_symbol *)
 	      _mesa_symbol_table_find_symbol(state->st, 0, $1);
 
+	   free($1);
+
 	   if (s == NULL) {
 	      yyerror(& @1, state, "invalid operand variable");
 	      YYERROR;
@@ -872,6 +883,8 @@
 	   struct asm_symbol *const s = (struct asm_symbol *)
 	      _mesa_symbol_table_find_symbol(state->st, 0, $1);
 
+	   free($1);
+
 	   if (s == NULL) {
 	      yyerror(& @1, state, "invalid operand variable");
 	      YYERROR;
@@ -943,6 +956,8 @@
 	   struct asm_symbol *const s = (struct asm_symbol *)
 	      _mesa_symbol_table_find_symbol(state->st, 0, $1);
 
+	   free($1);
+
 	   if (s == NULL) {
 	      yyerror(& @1, state, "invalid array member");
 	      YYERROR;
@@ -1081,6 +1096,7 @@
 	      declare_variable(state, $2, at_attrib, & @2);
 
 	   if (s == NULL) {
+	      free($2);
 	      YYERROR;
 	   } else {
 	      s->attrib_binding = $4;
@@ -1188,6 +1204,7 @@
 	      declare_variable(state, $2, at_param, & @2);
 
 	   if (s == NULL) {
+	      free($2);
 	      YYERROR;
 	   } else {
 	      s->param_binding_type = $3.param_binding_type;
@@ -1201,6 +1218,7 @@
 PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit
 	{
 	   if (($4 != 0) && ((unsigned) $4 != $6.param_binding_length)) {
+	      free($2);
 	      yyerror(& @4, state, 
 		      "parameter array size and number of bindings must match");
 	      YYERROR;
@@ -1209,6 +1227,7 @@
 		 declare_variable(state, $2, $6.type, & @2);
 
 	      if (s == NULL) {
+		 free($2);
 		 YYERROR;
 	      } else {
 		 s->param_binding_type = $6.param_binding_type;
@@ -1943,12 +1962,14 @@
 varNameList: varNameList ',' IDENTIFIER
 	{
 	   if (!declare_variable(state, $3, $<integer>0, & @3)) {
+	      free($3);
 	      YYERROR;
 	   }
 	}
 	| IDENTIFIER
 	{
 	   if (!declare_variable(state, $1, $<integer>0, & @1)) {
+	      free($1);
 	      YYERROR;
 	   }
 	}
@@ -1960,6 +1981,7 @@
 	      declare_variable(state, $3, at_output, & @3);
 
 	   if (s == NULL) {
+	      free($3);
 	      YYERROR;
 	   } else {
 	      s->output_binding = $5;
@@ -2136,17 +2158,21 @@
 	   struct asm_symbol *target = (struct asm_symbol *)
 	      _mesa_symbol_table_find_symbol(state->st, 0, $4);
 
+	   free($4);
+
 	   if (exist != NULL) {
 	      char m[1000];
 	      _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", $2);
+	      free($2);
 	      yyerror(& @2, state, m);
 	      YYERROR;
 	   } else if (target == NULL) {
+	      free($2);
 	      yyerror(& @4, state,
 		      "undefined variable binding in ALIAS statement");
 	      YYERROR;
 	   } else {
-	      _mesa_symbol_table_add_symbol(state->st, 0, strdup($2), target);
+	      _mesa_symbol_table_add_symbol(state->st, 0, $2, target);
 	   }
 	}
 	;
@@ -2337,14 +2363,10 @@
    if (exist != NULL) {
       yyerror(locp, state, "redeclared identifier");
    } else {
-      const size_t name_len = strlen(name);
-
-      s = calloc(1, sizeof(struct asm_symbol) + name_len + 1);
-      s->name = (char *)(s + 1);
+      s = calloc(1, sizeof(struct asm_symbol));
+      s->name = name;
       s->type = t;
 
-      memcpy((char *) s->name, name, name_len + 1);
-
       switch (t) {
       case at_temp:
 	 if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
@@ -2592,11 +2614,6 @@
    _mesa_memcpy (strz, str, len);
    strz[len] = '\0';
 
-   if (state->prog->String != NULL) {
-      _mesa_free(state->prog->String);
-      state->prog->String = NULL;
-   }
-
    state->prog->String = strz;
 
    state->st = _mesa_symbol_table_ctor();
@@ -2686,6 +2703,7 @@
    for (sym = state->sym; sym != NULL; sym = temp) {
       temp = sym->next;
 
+      _mesa_free((void *) sym->name);
       _mesa_free(sym);
    }
    state->sym = NULL;
@@ -2693,10 +2711,5 @@
    _mesa_symbol_table_dtor(state->st);
    state->st = NULL;
 
-   if (state->string_dumpster != NULL) {
-      _mesa_free(state->string_dumpster);
-      state->dumpster_size = 0;
-   }
-
    return result;
 }