mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-30 16:34:23 +00:00
Added null-termination for kernel build log.
This commit is contained in:
parent
f0e47ec8ec
commit
2588394e32
6
ocl.c
6
ocl.c
@ -619,8 +619,9 @@ build:
|
|||||||
size_t log_size;
|
size_t log_size;
|
||||||
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, 0, NULL, &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);
|
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);
|
applog(LOG_ERR, "%s", sz_log);
|
||||||
free(sz_log);
|
free(sz_log);
|
||||||
goto not_built;
|
goto not_built;
|
||||||
@ -756,8 +757,9 @@ built:
|
|||||||
size_t log_size;
|
size_t log_size;
|
||||||
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, 0, NULL, &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);
|
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);
|
applog(LOG_ERR, "%s", sz_log);
|
||||||
free(sz_log);
|
free(sz_log);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user