Skip to content
Snippets Groups Projects
Commit 64220b6a authored by Hugo Lefeuvre's avatar Hugo Lefeuvre Committed by Sébastien Blin
Browse files

Fix new-delete-type-mismatch in ringdht/p2p


Do not delete an object of derived class type through a pointer to
its base class type that has a non-virtual destructor. Instead, the
base class should be defined with a virtual destructor. Deleting an
object through a pointer to a type without a virtual destructor
results in undefined behavior.

Change-Id: I5a9f1ade5d67056f9ebc2865bd3c1c17fe197fcf
Reviewed-by: default avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent 704a614c
Branches
No related tags found
No related merge requests found
......@@ -129,6 +129,7 @@ struct CtrlMsgBase
{
CtrlMsgBase() = delete;
explicit CtrlMsgBase(CtrlMsgType id) : id_ {id} {}
virtual ~CtrlMsgBase() = default;
CtrlMsgType type() const noexcept { return id_; }
private:
const CtrlMsgType id_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment