diff --git a/modules/core/src/utils/filesystem.cpp b/modules/core/src/utils/filesystem.cpp index 99d764f1ea..6b444771b6 100644 --- a/modules/core/src/utils/filesystem.cpp +++ b/modules/core/src/utils/filesystem.cpp @@ -87,15 +87,18 @@ cv::String join(const cv::String& base, const cv::String& path) cv::String canonical(const cv::String& path) { + cv::String result; #ifdef _WIN32 - const char* result = _fullpath(NULL, path.c_str(), 0); + const char* result_str = _fullpath(NULL, path.c_str(), 0); #else - const char* result = realpath(path.c_str(), NULL); + const char* result_str = realpath(path.c_str(), NULL); #endif - if (result) - return cv::String(result); - // no error handling, just return input - return path; + if (result_str) + { + result = cv::String(result_str); + free((void*)result_str); + } + return result.empty() ? path : result; } diff --git a/platforms/scripts/valgrind.supp b/platforms/scripts/valgrind.supp index 074c2013c5..7a4341467f 100644 --- a/platforms/scripts/valgrind.supp +++ b/platforms/scripts/valgrind.supp @@ -134,6 +134,13 @@ fun:_ZNK2cv7TLSDataINS_11CoreTLSDataEE18createDataInstanceEv } +{ + OpenCV-UMatDataAutoLockerTLS + Memcheck:Leak + ... + fun:_ZN2cvL21getUMatDataAutoLockerEv +} + { OpenCV-haveOpenCL Memcheck:Leak