summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/arbprogparse.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-03-30 15:55:10 +0000
committerBrian Paul <[email protected]>2004-03-30 15:55:10 +0000
commita7f52a9ba1175174efb98a145248da331c9d4c54 (patch)
tree641c5555d51e466320b7ec5adf5e519c986bab20 /src/mesa/shader/arbprogparse.c
parent41d389909bc87d21cf7ef8639bead1b4494e3b0e (diff)
Reorder some code so we don't upset program state when there's a parsing error.
Be sure to assign program.Base.String pointer.
Diffstat (limited to 'src/mesa/shader/arbprogparse.c')
-rw-r--r--src/mesa/shader/arbprogparse.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index c2365a281c1..9099fd8f42c 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -3872,11 +3872,9 @@ _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len,
#endif
err = grammar_check (arbprogram_syn_id, strz, &parsed, &parsed_len);
- _mesa_free (strz);
- strz = NULL;
-
/* Syntax parse error */
if (err == 0) {
+ _mesa_free (strz);
grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos);
_mesa_set_program_error (ctx, error_pos, error_msg);
_mesa_error (ctx, GL_INVALID_OPERATION, "Parse Error");
@@ -3891,6 +3889,7 @@ _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len,
grammar_destroy (arbprogram_syn_id);
/* Initialize the arb_program struct */
+ program->Base.String = strz;
program->Base.NumInstructions =
program->Base.NumTemporaries =
program->Base.NumParameters =