gallium: Handle malloc failure.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 19 Jun 2008 13:57:33 +0000 (22:57 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 19 Jun 2008 14:05:09 +0000 (23:05 +0900)
src/gallium/auxiliary/tgsi/exec/tgsi_exec.c

index 6689c3f1fb21146b7c11a913465973b0c75fa8ab..13b8c2e5bf345c5bc3641efb385d98eec8d6f4fe 100644 (file)
@@ -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;