summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-06-19 22:57:33 +0900
committerJosé Fonseca <[email protected]>2008-06-19 23:05:09 +0900
commit6fbfcf922210ddf29b73290557f9d40171b09d2e (patch)
tree399e3a99036ebb9c9074446cb52770556c0c159f
parent6cbc2734d19567afeaa6c5d93149ef87b08cd167 (diff)
gallium: Handle malloc failure.
-rw-r--r--src/gallium/auxiliary/tgsi/exec/tgsi_exec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
index 6689c3f1fb2..13b8c2e5bf3 100644
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
@@ -165,9 +165,17 @@ tgsi_exec_machine_bind_shader(
declarations = (struct tgsi_full_declaration *)
MALLOC( maxDeclarations * sizeof(struct tgsi_full_declaration) );
+ if (!declarations) {
+ return;
+ }
+
instructions = (struct tgsi_full_instruction *)
MALLOC( maxInstructions * sizeof(struct tgsi_full_instruction) );
+ if (!instructions) {
+ FREE( declarations );
+ return;
+ }
while( !tgsi_parse_end_of_tokens( &parse ) ) {
uint pointer = parse.Position;