diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-03-08 17:45:23 -0500 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2012-03-08 17:45:23 -0500 |
commit | 35162ce669bd02d07c7d1e708c2932dab7248690 (patch) | |
tree | 2f472c554e7e016042441e3bdc89f27bc6ac4ccd | |
parent | aa88e1e8aafe3467d77c6ce0003fc3e9ce32281f (diff) |
util: Fix file loading bug
-rw-r--r-- | util.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |