nvc0/ir: fix use after free in texture barrier insertion pass

Fixes crash with Amnesia: The Dark Descent.

Cc: "9.2 and 9.1" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
Tiziano Bacocco
2013-07-30 22:04:49 +02:00
committed by Christoph Bumiller
parent 3282697621
commit 7086636358
@@ -443,6 +443,7 @@ NVC0LegalizePostRA::insertTextureBarriers(Function *fn)
if (i->op == OP_TEXBAR) {
if (i->subOp >= max) {
delete_Instruction(prog, i);
i = NULL;
} else {
max = i->subOp;
if (prev && prev->op == OP_TEXBAR && prev->subOp >= max) {
@@ -454,7 +455,7 @@ NVC0LegalizePostRA::insertTextureBarriers(Function *fn)
if (isTextureOp(i->op)) {
max++;
}
if (!i->isNop())
if (i && !i->isNop())
prev = i;
}
}