From d164d513808ecaf8921a8841a663f5c50bce5b52 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 5 Mar 2015 10:31:51 +0300 Subject: [PATCH] Fix potential null pointer dereference --- modules/core/src/matrix.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index e1e9caa837..c1d2c34852 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -205,9 +205,12 @@ 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) ) {