diff --git a/modules/cudaimgproc/src/gftt.cpp b/modules/cudaimgproc/src/gftt.cpp index 544cd8834..ae19087aa 100644 --- a/modules/cudaimgproc/src/gftt.cpp +++ b/modules/cudaimgproc/src/gftt.cpp @@ -135,15 +135,17 @@ namespace int total = findCorners_gpu(eigTex_, eig_.rows, eig_.cols, static_cast(maxVal * qualityLevel_), mask, tmpCorners_.ptr(), tmpCorners_.cols, counterPtr_, stream_); - if (total == 0) { _corners.release(); + cudaSafeCall( cudaDestroyTextureObject(eigTex_) ); return; } sortCorners_gpu(eigTex_, tmpCorners_.ptr(), total, stream_); + cudaSafeCall( cudaDestroyTextureObject(eigTex_) ); + if (minDistance_ < 1) { tmpCorners_.colRange(0, maxCorners_ > 0 ? std::min(maxCorners_, total) : total).copyTo(_corners, stream);