Fix a potential bug of ocl::CannyBuf.
authorpeng xiao <hisenxpress@gmail.com>
Fri, 12 Apr 2013 07:43:33 +0000 (15:43 +0800)
committerpeng xiao <hisenxpress@gmail.com>
Fri, 12 Apr 2013 07:43:33 +0000 (15:43 +0800)
The program would crash if release is called twice.

modules/ocl/src/canny.cpp

index 4219af1..e06d299 100644 (file)
@@ -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