From f2a1c8bf30adc15954c1e11a5a3e69cd5ccfa353 Mon Sep 17 00:00:00 2001 From: Victor Zarubkin Date: Sat, 25 Jun 2016 17:30:39 +0300 Subject: [PATCH] fixed potential memory leak on move operator --- include/profiler/reader.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/profiler/reader.h b/include/profiler/reader.h index f82e478..48d1d66 100644 --- a/include/profiler/reader.h +++ b/include/profiler/reader.h @@ -63,7 +63,7 @@ struct BlocksTree } - BlocksTree(BlocksTree&& that) + BlocksTree(BlocksTree&& that) : BlocksTree() { makeMove(::std::forward(that)); } @@ -95,6 +95,11 @@ private: void makeMove(BlocksTree&& that) { + if (node && node != that.node) + { + delete node; + } + children = ::std::move(that.children); node = that.node; frame_statistics = that.frame_statistics;