Commit f849d2d6 authored by Vinson Lee's avatar Vinson Lee

fp-indirections: Check for malloc failures.

fglrx returns 2147483647 for GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB on
some GPUs.
parent 327e7085
......@@ -83,6 +83,12 @@ static char *gen_temporary_dest_indirections(int sample_count,
prog = malloc(strlen(pre) + strlen(sample) * sample_count +
strlen(post) + 1);
if (prog == 0) {
printf("malloc failed.\n");
piglit_report_result(PIGLIT_FAILURE);
exit(1);
}
sprintf(prog, pre);
for (i = 0; i < sample_count; i++)
strcat(prog, sample);
......@@ -145,6 +151,12 @@ static char *gen_temporary_source_indirections(int sample_count,
prog = malloc(strlen(pre) + strlen(sample) * (sample_count - 1) +
strlen(post) + 1);
if (prog == 0) {
printf("malloc failed.\n");
piglit_report_result(PIGLIT_FAILURE);
exit(1);
}
sprintf(prog, pre);
for (i = 0; i < sample_count - 1; i++)
strcat(prog, sample);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment