Merge pull request #1167 from umogSlayer/fix-move-assignment-memory-leak

Fix memory leak inside the move assignment operator of rust::Error class
This commit is contained in:
David Tolnay 2023-01-26 20:45:48 -08:00 committed by GitHub
commit 320b7af3eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;