diff options
-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; |