summaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authoreivanov89 <[email protected]>2026-05-27 11:54:08 +0300
committereivanov89 <[email protected]>2026-05-27 12:26:58 +0300
commitcb61d6325fb2a222fb8f3acdb0ecf5f6c1ca4c2f (patch)
tree45bef80ceb525c8627f49f2655086eff9e2626bc /library/cpp
parent70c071bc7469291f31c8ee9b2d706dabcd22f912 (diff)
Fix move assignment
commit_hash:e8b2304f773f981dd79203f68a204671954ee399
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;
}