Browse Source

Added null-termination for kernel build log.

djm34
troky 11 years ago
parent
commit
2588394e32
  1. 6
      ocl.c

6
ocl.c

@ -619,8 +619,9 @@ build: @@ -619,8 +619,9 @@ build:
size_t log_size;
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
char *sz_log = (char *)malloc(log_size);
char *sz_log = (char *)malloc(log_size + 1);
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, log_size, sz_log, NULL);
sz_log[log_size] = '\0';
applog(LOG_ERR, "%s", sz_log);
free(sz_log);
goto not_built;
@ -756,8 +757,9 @@ built: @@ -756,8 +757,9 @@ built:
size_t log_size;
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
char *sz_log = (char *)malloc(log_size);
char *sz_log = (char *)malloc(log_size + 1);
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, log_size, sz_log, NULL);
sz_log[log_size] = '\0';
applog(LOG_ERR, "%s", sz_log);
free(sz_log);
return NULL;

Loading…
Cancel
Save