summaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/histogram/hdr/histogram.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/library/cpp/histogram/hdr/histogram.cpp b/library/cpp/histogram/hdr/histogram.cpp
index 175179f38ae..4d9904fb22f 100644
--- a/library/cpp/histogram/hdr/histogram.cpp
+++ b/library/cpp/histogram/hdr/histogram.cpp
@@ -51,8 +51,14 @@ namespace NHdr {
}
THistogram& THistogram::operator=(THistogram&& rhs) noexcept {
- Data_ = std::move(rhs.Data_);
- Allocator_ = rhs.Allocator_;
+ if (this != &rhs) {
+ if (Data_) {
+ size_t size = GetMemorySize();
+ Allocator_->Release({Data_.Release(), size});
+ }
+ Data_ = std::move(rhs.Data_);
+ Allocator_ = rhs.Allocator_;
+ }
return *this;
}