diff --git a/modules/ocl/src/canny.cpp b/modules/ocl/src/canny.cpp index 4219af1ca2..e06d29904e 100644 --- a/modules/ocl/src/canny.cpp +++ b/modules/ocl/src/canny.cpp @@ -112,7 +112,11 @@ void cv::ocl::CannyBuf::release() mapBuf.release(); trackBuf1.release(); trackBuf2.release(); - openCLFree(counter); + if(counter) + { + openCLFree(counter); + counter = NULL; + } } namespace cv