Browse Source

glsl: don't allocate 0-length children array in slang_operation_copy()

tags/mesa_7_5_rc4
Brian Paul 17 years ago
parent
commit
c1f74a6734
1 changed files with 7 additions and 6 deletions
  1. 7
    6
      src/mesa/shader/slang/slang_compile_operation.c

+ 7
- 6
src/mesa/shader/slang/slang_compile_operation.c View File

@@ -119,11 +119,13 @@ slang_operation_copy(slang_operation * x, const slang_operation * y)
if (!slang_operation_construct(&z))
return GL_FALSE;
z.type = y->type;
z.children = (slang_operation *)
_slang_alloc(y->num_children * sizeof(slang_operation));
if (z.children == NULL) {
slang_operation_destruct(&z);
return GL_FALSE;
if (y->num_children > 0) {
z.children = (slang_operation *)
_slang_alloc(y->num_children * sizeof(slang_operation));
if (z.children == NULL) {
slang_operation_destruct(&z);
return GL_FALSE;
}
}
for (z.num_children = 0; z.num_children < y->num_children;
z.num_children++) {
@@ -285,4 +287,3 @@ slang_operation_add_children(slang_operation *oper, GLuint num_children)
}
}



Loading…
Cancel
Save