Fixing of AutoBuffer::allocate(nsz) method
authorVitaliy Lyudvichenko <ludv1x@yandex.ru>
Wed, 29 Jun 2016 16:50:51 +0000 (19:50 +0300)
committerAlexander Alekhin <alexander.alekhin@itseez.com>
Thu, 30 Jun 2016 10:10:53 +0000 (13:10 +0300)
AutoBuffer::allocate(nsz) didn't work properly when
(sz < nsz < fixed_size). In this case sz remained unchanged.

modules/core/include/opencv2/core/operations.hpp

index 0ae51c6..076a5e4 100644 (file)
@@ -2558,10 +2558,10 @@ template<typename _Tp, size_t fixed_size> inline void AutoBuffer<_Tp, fixed_size
     if(_size <= size)
         return;
     deallocate();
+    size = _size;
     if(_size > fixed_size)
     {
         ptr = cv::allocate<_Tp>(_size);
-        size = _size;
     }
 }