0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-28 17:28:14 +08:00

fixed potential memory leak on move operator

This commit is contained in:
Victor Zarubkin 2016-06-25 17:30:39 +03:00
parent 06192258ed
commit f2a1c8bf30

View File

@ -63,7 +63,7 @@ struct BlocksTree
} }
BlocksTree(BlocksTree&& that) BlocksTree(BlocksTree&& that) : BlocksTree()
{ {
makeMove(::std::forward<BlocksTree&&>(that)); makeMove(::std::forward<BlocksTree&&>(that));
} }
@ -95,6 +95,11 @@ private:
void makeMove(BlocksTree&& that) void makeMove(BlocksTree&& that)
{ {
if (node && node != that.node)
{
delete node;
}
children = ::std::move(that.children); children = ::std::move(that.children);
node = that.node; node = that.node;
frame_statistics = that.frame_statistics; frame_statistics = that.frame_statistics;