diff --git a/modules/objdetect/src/cascadedetect.cpp b/modules/objdetect/src/cascadedetect.cpp index ef9d21ec1..68b923e81 100644 --- a/modules/objdetect/src/cascadedetect.cpp +++ b/modules/objdetect/src/cascadedetect.cpp @@ -1557,7 +1557,7 @@ bool CascadeClassifier::load( const String& filename ) bool CascadeClassifier::read(const FileNode &root) { - Ptr ccimpl; + Ptr ccimpl = makePtr(); bool ok = ccimpl->read_(root); if( ok ) cc = ccimpl.staticCast();