1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Fix memory leak in PDU's move assignment operator

Fixes #272
This commit is contained in:
Matias Fontanini
2017-12-14 14:42:46 -03:00
parent 8f85a6e557
commit f44b253a42
2 changed files with 10 additions and 1 deletions

View File

@@ -244,8 +244,9 @@ public:
* \param rhs The PDU to be moved.
*/
PDU& operator=(PDU &&rhs) TINS_NOEXCEPT {
delete inner_pdu_;
inner_pdu_ = 0;
std::swap(inner_pdu_, rhs.inner_pdu_);
rhs.inner_pdu_ = 0;
if (inner_pdu_) {
inner_pdu_->parent_pdu(this);
}