diff --git a/modules/core/src/cuda_host_mem.cpp b/modules/core/src/cuda_host_mem.cpp index 2ad733b67..70dd840bd 100644 --- a/modules/core/src/cuda_host_mem.cpp +++ b/modules/core/src/cuda_host_mem.cpp @@ -107,10 +107,13 @@ public: void deallocate(UMatData* u) const { + if (!u) + return; + CV_Assert(u->urefcount >= 0); CV_Assert(u->refcount >= 0); - if (u && u->refcount == 0) + if (u->refcount == 0) { if ( !(u->flags & UMatData::USER_ALLOCATED) ) {