From ea48fcfc9f41084336f4601a3b72fe5f5d1487ca Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Mon, 9 Feb 2015 12:38:02 +0300 Subject: [PATCH] Fix possible null pointer dereference --- modules/core/src/cuda_host_mem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/core/src/cuda_host_mem.cpp b/modules/core/src/cuda_host_mem.cpp index 2ad733b675..70dd840bd3 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) ) {