From 2c4120974c11eed145a9864026168b7d50f6332f Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 22 Aug 2020 21:30:53 +0100 Subject: [PATCH] Follow rule of three for HTTPRepo:ChildInfo --- simgear/io/HTTPRepository.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index a396a2bb..b6967acf 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -190,9 +190,8 @@ class HTTPDirectory { } - // REVIEW: Memory Leak - 93,275 bytes in 2,275 blocks are indirectly lost - // Default copy-ctor is inappropriate when using dynamic memory allocation ChildInfo(const ChildInfo& other) = default; + ChildInfo& operator=(const ChildInfo& other) = default; void setSize(const std::string & sizeData) { @@ -586,7 +585,7 @@ private: // emplace_back is triggering an allocation which is leading to a leak // Implies that ci is lacking a proper copy-ctor/assignment-op children.emplace_back(ci); - children.back().path = absolutePath() / tokens[1]; + children.back().path = absolutePath() / tokens[1]; if (tokens.size() > 3) { children.back().setSize(tokens[3]); }