summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-10-29 17:07:09 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-10-29 17:07:09 +0000
commit1a979736a6524a2987fcd6a8b1eda10016db96df (patch)
tree97879cdb91f66c41a8b85ee3d8abf470a840efa4 /src/mesa
parent5244fc6d60a365f04b85cbd035abf9bee93b3f4f (diff)
Free old parameter list before assigning new one. FIxes memory leak.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/arbfragparse.c11
-rw-r--r--src/mesa/shader/arbvertparse.c5
2 files changed, 13 insertions, 3 deletions
diff --git a/src/mesa/shader/arbfragparse.c b/src/mesa/shader/arbfragparse.c
index 3ef6f8b137..7b9abec1c9 100644
--- a/src/mesa/shader/arbfragparse.c
+++ b/src/mesa/shader/arbfragparse.c
@@ -209,14 +209,19 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
program->Base.NumParameters = ap.Base.NumParameters;
program->Base.NumAttributes = ap.Base.NumAttributes;
program->Base.NumAddressRegs = ap.Base.NumAddressRegs;
+ program->NumAluInstructions = ap.NumAluInstructions;
+ program->NumTexInstructions = ap.NumTexInstructions;
+ program->NumTexIndirections = ap.NumTexIndirections;
program->InputsRead = ap.InputsRead;
program->OutputsWritten = ap.OutputsWritten;
for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
program->TexturesUsed[i] = ap.TexturesUsed[i];
- program->NumAluInstructions = ap.NumAluInstructions;
- program->NumTexInstructions = ap.NumTexInstructions;
- program->NumTexIndirections = ap.NumTexIndirections;
+
+ if (program->Parameters) {
+ /* free previous program's parameters */
+ _mesa_free_parameter_list(program->Parameters);
+ }
program->Parameters = ap.Parameters;
program->FogOption = ap.FogOption;
diff --git a/src/mesa/shader/arbvertparse.c b/src/mesa/shader/arbvertparse.c
index 0208389c35..5d1ad3de2e 100644
--- a/src/mesa/shader/arbvertparse.c
+++ b/src/mesa/shader/arbvertparse.c
@@ -191,6 +191,11 @@ _mesa_parse_arb_vertex_program(GLcontext * ctx, GLenum target,
program->IsPositionInvariant = ap.HintPositionInvariant;
program->InputsRead = ap.InputsRead;
program->OutputsWritten = ap.OutputsWritten;
+
+ if (program->Parameters) {
+ /* free previous program's parameters */
+ _mesa_free_parameter_list(program->Parameters);
+ }
program->Parameters = ap.Parameters;
program->Instructions = ap.VPInstructions;