summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2012-03-08 17:45:23 -0500
committerTom Stellard <thomas.stellard@amd.com>2012-03-08 17:45:23 -0500
commit35162ce669bd02d07c7d1e708c2932dab7248690 (patch)
tree2f472c554e7e016042441e3bdc89f27bc6ac4ccd
parentaa88e1e8aafe3467d77c6ce0003fc3e9ce32281f (diff)
util: Fix file loading bug
-rw-r--r--util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util.c b/util.c
index 33031cb..3a95c99 100644
--- a/util.c
+++ b/util.c
@@ -127,13 +127,13 @@ unsigned cluCreateKernel(cl_context context, cl_device_id device_id,
/* Read code */
do {
- code = realloc(code, (bytes_read + CODE_CHUNK) * sizeof(unsigned char));
+ code = realloc(code, (code_len + CODE_CHUNK) * sizeof(unsigned char));
if (!code) {
fprintf(stderr, "Failed to realloc code.\n");
return 0;
}
- bytes_read = read(fd, code + bytes_read, CODE_CHUNK);
+ bytes_read = read(fd, code + code_len, CODE_CHUNK);
if (bytes_read < 0) {
fprintf(stderr, "Failed to read code.\n");
return 0;