summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorAndre Maasikas <[email protected]>2010-09-02 11:09:52 +0300
committerAndre Maasikas <[email protected]>2010-09-09 11:08:11 +0300
commit7753416c5b6bdcc757983400c50c5cf878bc9caf (patch)
treeef5d1d7b5b2f4b34dd36971846483deb875d0b05 /src/mesa
parent5697bf166082119593bf1297028d03a7938eacfb (diff)
r600: protect cleanup instructions from double free
We might get the cleanup when we have not translated the shader yet e.g 2 programstringnotifys in a row
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.c9
-rw-r--r--src/mesa/drivers/dri/r600/r700_shader.c13
2 files changed, 20 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 9c5a5053d97..5d557f725ac 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -8076,20 +8076,27 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode,
GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode)
{
- FREE(pR700AsmCode->pInstDeps);
+ if(NULL != pR700AsmCode->pInstDeps)
+ {
+ FREE(pR700AsmCode->pInstDeps);
+ pR700AsmCode->pInstDeps = NULL;
+ }
if(NULL != pR700AsmCode->subs)
{
FREE(pR700AsmCode->subs);
+ pR700AsmCode->subs = NULL;
}
if(NULL != pR700AsmCode->callers)
{
FREE(pR700AsmCode->callers);
+ pR700AsmCode->callers = NULL;
}
if(NULL != pR700AsmCode->presubs)
{
FREE(pR700AsmCode->presubs);
+ pR700AsmCode->presubs = NULL;
}
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c
index 67b0d40308e..8b3ed5cd823 100644
--- a/src/mesa/drivers/dri/r600/r700_shader.c
+++ b/src/mesa/drivers/dri/r600/r700_shader.c
@@ -584,7 +584,11 @@ void cleanup_vfetch_shaderinst(R700_Shader *pShader)
void Clean_Up_Shader(R700_Shader *pShader)
{
- FREE(pShader->pProgram);
+ if(NULL != pShader->pProgram)
+ {
+ FREE(pShader->pProgram);
+ pShader->pProgram = NULL;
+ }
R700ShaderInstruction *pInst;
R700ShaderInstruction *pInstToFree;
@@ -596,6 +600,8 @@ void Clean_Up_Shader(R700_Shader *pShader)
pInst = pInst->pNextInst;
FREE(pInstToFree);
};
+ pShader->lstCFInstructions.pHead = NULL;
+
pInst = pShader->lstALUInstructions.pHead;
while(NULL != pInst)
{
@@ -603,6 +609,8 @@ void Clean_Up_Shader(R700_Shader *pShader)
pInst = pInst->pNextInst;
FREE(pInstToFree);
};
+ pShader->lstALUInstructions.pHead = NULL;
+
pInst = pShader->lstTEXInstructions.pHead;
while(NULL != pInst)
{
@@ -610,6 +618,8 @@ void Clean_Up_Shader(R700_Shader *pShader)
pInst = pInst->pNextInst;
FREE(pInstToFree);
};
+ pShader->lstTEXInstructions.pHead = NULL;
+
pInst = pShader->lstVTXInstructions.pHead;
while(NULL != pInst)
{
@@ -617,5 +627,6 @@ void Clean_Up_Shader(R700_Shader *pShader)
pInst = pInst->pNextInst;
FREE(pInstToFree);
};
+ pShader->lstVTXInstructions.pHead = NULL;
}