Plugging leaks
This commit is contained in:
parent
8f391b9654
commit
5d8e758724
1 changed files with 10 additions and 6 deletions
|
|
@ -149,12 +149,15 @@ public:
|
||||||
*/
|
*/
|
||||||
Buffer(Buffer<Type>&& other)
|
Buffer(Buffer<Type>&& other)
|
||||||
{
|
{
|
||||||
largerSize = std::exchange(other.largerSize, 0);
|
if (this != &other) {
|
||||||
alignedSize = std::exchange(other.alignedSize, 0);
|
std::free(paddedData);
|
||||||
paddedData = std::exchange(other.paddedData, nullptr);
|
largerSize = std::exchange(other.largerSize, 0);
|
||||||
normalData = std::exchange(other.normalData, nullptr);
|
alignedSize = std::exchange(other.alignedSize, 0);
|
||||||
normalEnd = std::exchange(other.normalEnd, nullptr);
|
paddedData = std::exchange(other.paddedData, nullptr);
|
||||||
_alignedEnd = std::exchange(other._alignedEnd, nullptr);
|
normalData = std::exchange(other.normalData, nullptr);
|
||||||
|
normalEnd = std::exchange(other.normalEnd, nullptr);
|
||||||
|
_alignedEnd = std::exchange(other._alignedEnd, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer<Type>& operator=(const Buffer<Type>& other)
|
Buffer<Type>& operator=(const Buffer<Type>& other)
|
||||||
|
|
@ -188,6 +191,7 @@ public:
|
||||||
constexpr iterator end() noexcept { return normalEnd; }
|
constexpr iterator end() noexcept { return normalEnd; }
|
||||||
constexpr pointer alignedEnd() noexcept { return _alignedEnd; }
|
constexpr pointer alignedEnd() noexcept { return _alignedEnd; }
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr auto AlignmentMask { Alignment - 1 };
|
static constexpr auto AlignmentMask { Alignment - 1 };
|
||||||
static constexpr auto TypeAlignment { Alignment / sizeof(value_type) };
|
static constexpr auto TypeAlignment { Alignment / sizeof(value_type) };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue