From: yao Date: Tue, 28 May 2013 10:07:41 +0000 (+0800) Subject: fix memory leak X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1314^2~1272^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d81c145fa966c4973810a4e21a207adfa3cf1b24;p=platform%2Fupstream%2Fopencv.git fix memory leak --- diff --git a/modules/ocl/src/hog.cpp b/modules/ocl/src/hog.cpp index ae74ed5..a351458 100644 --- a/modules/ocl/src/hog.cpp +++ b/modules/ocl/src/hog.cpp @@ -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(kernel); + openCLSafeCall(clReleaseKernel(kernel)); if (wave_size <= 16) { char build_options[64]; diff --git a/modules/ocl/src/pyrlk.cpp b/modules/ocl/src/pyrlk.cpp index 3b6edf7..a3e65dd 100644 --- a/modules/ocl/src/pyrlk.cpp +++ b/modules/ocl/src/pyrlk.cpp @@ -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(kernel); + openCLSafeCall(clReleaseKernel(kernel)); + static char opt[16] = {0}; sprintf(opt, " -D WAVE_SIZE=%d", wave_size);