1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

core: fix Mat/UMat cleanup on exceptions in deallocate()

This commit is contained in:
Alexander Alekhin
2017-07-25 12:26:53 +03:00
parent 0194d5a2d5
commit 7f3eea6325
2 changed files with 7 additions and 4 deletions
+5 -3
View File
@@ -60,7 +60,6 @@ void MatAllocator::unmap(UMatData* u) const
if(u->urefcount == 0 && u->refcount == 0)
{
deallocate(u);
u = NULL;
}
}
@@ -461,8 +460,11 @@ void Mat::copySize(const Mat& m)
void Mat::deallocate()
{
if(u)
(u->currAllocator ? u->currAllocator : allocator ? allocator : getDefaultAllocator())->unmap(u);
u = NULL;
{
UMatData* u_ = u;
u = NULL;
(u_->currAllocator ? u_->currAllocator : allocator ? allocator : getDefaultAllocator())->unmap(u_);
}
}
Mat::Mat(const Mat& m, const Range& _rowRange, const Range& _colRange)