diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 65b93890e..829a009e1 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -222,11 +222,10 @@ public: } }; - MatAllocator* Mat::getStdAllocator() { - static MatAllocator * allocator = new StdMatAllocator(); - return allocator; + static StdMatAllocator allocator; + return &allocator; } void swap( Mat& a, Mat& b )