aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program/nvfragparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/program/nvfragparse.c')
-rw-r--r--mesalib/src/mesa/program/nvfragparse.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/mesalib/src/mesa/program/nvfragparse.c b/mesalib/src/mesa/program/nvfragparse.c
index f61221c11..f251d7e6c 100644
--- a/mesalib/src/mesa/program/nvfragparse.c
+++ b/mesalib/src/mesa/program/nvfragparse.c
@@ -1236,7 +1236,7 @@ Parse_PrintInstruction(struct parse_state *parseState,
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
- msg = (GLubyte*) malloc(len + 1);
+ msg = malloc(len + 1);
memcpy(msg, str, len);
msg[len] = 0;
@@ -1481,7 +1481,7 @@ _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
GLubyte *programString;
/* Make a null-terminated copy of the program string */
- programString = (GLubyte *) malloc(len + 1);
+ programString = malloc(len + 1);
if (!programString) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
@@ -1549,14 +1549,10 @@ _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
/* install the program */
program->Base.Target = target;
- if (program->Base.String) {
- free(program->Base.String);
- }
+ free(program->Base.String);
program->Base.String = programString;
program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
- if (program->Base.Instructions) {
- free(program->Base.Instructions);
- }
+ free(program->Base.Instructions);
program->Base.Instructions = newInst;
program->Base.NumInstructions = parseState.numInst;
program->Base.InputsRead = parseState.inputsRead;