Skip to content

Commit

Permalink
Merge pull request #1167 from umogSlayer/fix-move-assignment-memory-leak
Browse files Browse the repository at this point in the history
Fix memory leak inside the move assignment operator of rust::Error class
  • Loading branch information
dtolnay committed Jan 27, 2023
2 parents d49ab22 + 2f8918f commit 320b7af
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/cxx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ Error &Error::operator=(const Error &other) & {

Error &Error::operator=(Error &&other) &noexcept {
std::exception::operator=(std::move(other));
delete[] this->msg;
this->msg = other.msg;
this->len = other.len;
other.msg = nullptr;
Expand Down

0 comments on commit 320b7af

Please sign in to comment.