From 4f328d8388980604330f0ea1d28ae5734983d648 Mon Sep 17 00:00:00 2001 From: peng xiao Date: Fri, 12 Apr 2013 15:43:33 +0800 Subject: [PATCH] Fix a potential bug of ocl::CannyBuf. The program would crash if release is called twice. --- modules/ocl/src/canny.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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