From 95316118206aeed718ae6260ef9b5a1a4a6dacd8 Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 19 Jul 2018 14:43:35 -0400 Subject: fix mem leak --- include/hotstuff/consensus.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include/hotstuff/consensus.h') diff --git a/include/hotstuff/consensus.h b/include/hotstuff/consensus.h index 1f1e6ea..a3a1f25 100644 --- a/include/hotstuff/consensus.h +++ b/include/hotstuff/consensus.h @@ -45,7 +45,9 @@ class HotStuffCore { BoxObj storage; HotStuffCore(ReplicaID id, privkey_bt &&priv_key); - virtual ~HotStuffCore() = default; + virtual ~HotStuffCore() { + b0->qc_ref = nullptr; + } /* Inputs of the state machine triggered by external events, should called * by the class user, with proper invariants. */ @@ -173,7 +175,7 @@ struct Proposal: public Serializable { << "rid=" << std::to_string(proposer) << " " << "bqc=" << get_hex10(bqc_hash) << " " << "blk=" << get_hex10(blk->get_hash()) << ">"; - return std::string(std::move(s)); + return std::move(s); } }; @@ -243,7 +245,7 @@ struct Vote: public Serializable { << "bqc=" << get_hex10(bqc_hash) << " " << "blk=" << get_hex10(blk_hash) << " " << "cert=" << (cert ? "yes" : "no") << ">"; - return std::string(std::move(s)); + return std::move(s); } }; -- cgit v1.2.3