fix memory leak

This commit is contained in:
yao 2013-05-28 18:07:41 +08:00
parent c58e0d5d73
commit d81c145fa9
2 changed files with 3 additions and 1 deletions

View File

@ -1580,6 +1580,7 @@ static void openCLExecuteKernel_hog(Context *clCxt , const char **source, string
{
cl_kernel kernel = openCLGetKernelFromSource(clCxt, source, kernelName);
size_t wave_size = queryDeviceInfo<WAVEFRONT_SIZE, size_t>(kernel);
openCLSafeCall(clReleaseKernel(kernel));
if (wave_size <= 16)
{
char build_options[64];

View File

@ -139,8 +139,9 @@ static void lkSparse_run(oclMat &I, oclMat &J,
stringstream idxStr;
idxStr << kernelName << "_C" << I.oclchannels() << "_D" << I.depth();
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &pyrlk, idxStr.str());
int wave_size = queryDeviceInfo<WAVEFRONT_SIZE, int>(kernel);
openCLSafeCall(clReleaseKernel(kernel));
static char opt[16] = {0};
sprintf(opt, " -D WAVE_SIZE=%d", wave_size);